/** * add properties */ public function setProperties() { parent::setProperties($this->getAdditionalInfo('properties')); }
/** * set properties */ public function setProperties() { if (empty($this->_ignoredProductAttributeCodes)) { $ignoredProductAttributeCodes = array("manufacturer", "model"); $ignoredProperties = explode(",", Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EXPORT_FILTER_PROPERTIES)); $ignoredProductAttributeCodes = array_merge($ignoredProductAttributeCodes, $ignoredProperties); $this->_ignoredProductAttributeCodes = array_unique($ignoredProductAttributeCodes); } if (empty($this->_forcedProductAttributeCodes)) { $forcedProperties = explode(",", Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EXPORT_FORCE_PROPERTY_EXPORT)); $this->_forcedProductAttributeCodes = array_unique($forcedProperties); } $result = array(); $cacheKey = 'product_type_' . $this->item->getTypeId() . '_attributes_' . $this->item->getAttributeSetId(); $cache = Mage::app()->getCacheInstance(); $value = $cache->load($cacheKey); if ($value !== false) { $attributes = unserialize($value); } else { $attributes = $this->item->getAttributes(); $attrCache = array(); foreach ($attributes as $attribute) { $code = $attribute->getAttributeCode(); /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */ if ($attribute && $attribute->getIsVisibleOnFront() || in_array($code, $this->_forcedProductAttributeCodes)) { if (in_array($code, $this->_ignoredProductAttributeCodes) && !in_array($code, $this->_forcedProductAttributeCodes)) { continue; } $attrCache[$code] = array('id' => $attribute->getId(), 'label' => $attribute->getStoreLabel($this->_getConfig()->getStoreViewId())); } } $attributes = $attrCache; $cache->save(serialize($attrCache), $cacheKey, array('shopgate_export', Mage_Core_Model_Mysql4_Collection_Abstract::CACHE_TAG, Mage_Catalog_Model_Resource_Eav_Attribute::CACHE_TAG), 60); } foreach ($attributes as $code => $data) { $value = $this->item->getResource()->getAttribute($code)->getFrontend()->getValue($this->item); if (!empty($value) && !is_array($value)) { $propertyItemObject = new Shopgate_Model_Catalog_Property(); $propertyItemObject->setUid($data['id']); $propertyItemObject->setLabel($data['label']); $propertyItemObject->setValue($value); $result[] = $propertyItemObject; } } parent::setProperties($result); }