コード例 #1
0
 /**
  * Update changeable properties of a managed attribute
  *
  * @param Mage_Catalog_Model_Entity_Attribute              $attribute       Attribute to update
  * @param Aoe_AttributeConfigurator_Model_Config_Attribute $attributeConfig Attribute config
  * @param array                                            $attributeDiff   Attributes to be updated
  * @return void
  * @throws Aoe_AttributeConfigurator_Model_Sync_Import_Attribute_Exception
  */
 protected function _changeableAttributeUpdate($attribute, $attributeConfig, $attributeDiff)
 {
     if (!empty($attributeDiff)) {
         $attributeSetting = $attributeConfig->getSettingsAsArray();
         foreach ($attributeDiff as $property) {
             if (in_array($property, $this->_changeableProps)) {
                 if ($this->_validateProperty($property, $attributeSetting[$property])) {
                     $attribute->setData($property, $attributeSetting[$property]);
                 } else {
                     $this->_getHelper()->log(sprintf('Property \'%s\' of Attribute \'%s\' skipped: \'%s\' is no valid value.', $property, $attributeConfig->getCode(), $attributeSetting[$property]));
                 }
             }
         }
         try {
             $attribute->save();
         } catch (Exception $e) {
             throw new Aoe_AttributeConfigurator_Model_Sync_Import_Attribute_Exception($e->getMessage(), $e->getCode(), $e);
         }
     }
 }