1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_ImportExport
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Export entity product type abstract model
29: *
30: * @category Mage
31: * @package Mage_ImportExport
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: abstract class Mage_ImportExport_Model_Export_Entity_Product_Type_Abstract
35: {
36: /**
37: * Overriden attributes parameters.
38: *
39: * @var array
40: */
41: protected $_attributeOverrides = array();
42:
43: /**
44: * Array of attributes codes which are disabled for export.
45: *
46: * @var array
47: */
48: protected $_disabledAttrs = array();
49:
50: /**
51: * Attributes with index (not label) value.
52: *
53: * @var array
54: */
55: protected $_indexValueAttributes = array();
56:
57: /**
58: * Return disabled attributes codes.
59: *
60: * @return array
61: */
62: public function getDisabledAttrs()
63: {
64: return $this->_disabledAttrs;
65: }
66:
67: /**
68: * Get attribute codes with index (not label) value.
69: *
70: * @return array
71: */
72: public function getIndexValueAttributes()
73: {
74: return $this->_indexValueAttributes;
75: }
76:
77: /**
78: * Additional check for model availability. If method returns FALSE - model is not suitable for data processing.
79: *
80: * @return bool
81: */
82: public function isSuitable()
83: {
84: return true;
85: }
86:
87: /**
88: * Add additional data to attribute.
89: *
90: * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
91: * @return boolean
92: */
93: public function overrideAttribute(Mage_Catalog_Model_Resource_Eav_Attribute $attribute)
94: {
95: if (!empty($this->_attributeOverrides[$attribute->getAttributeCode()])) {
96: $data = $this->_attributeOverrides[$attribute->getAttributeCode()];
97:
98: if (isset($data['options_method']) && method_exists($this, $data['options_method'])) {
99: $data['filter_options'] = $this->$data['options_method']();
100: }
101: $attribute->addData($data);
102:
103: return true;
104: }
105: return false;
106: }
107: }
108: