/** * Add option to select or multiselect attribute * * @param integer|string $attribute attribute ID or code * @param array $data * @return integer */ public function addOption($attribute, $data) { $parent = parent::addOption($attribute, $data); if ($parent) { $model = $this->_getAttribute($attribute); /** @var $helperCatalog Mage_Catalog_Helper_Data */ $helperCatalog = Mage::helper('catalog'); foreach ($data['label'] as $label) { $labelText = $helperCatalog->stripTags($label['value']); } $code = $model->getAttributeCode(); $_product = Mage::getModel('catalog/product'); $attr = $_product->getResource()->getAttribute($code); if ($attr->usesSource()) { $option_id = $attr->getSource()->getOptionId($labelText); } return $option_id; } return $parent; }
/** * Add option to select or multiselect attribute * * @param integer|string $attribute attribute ID or code * @param array $data * @return bool */ public function addOption($attribute, $data) { Mage::helper('api')->toArray($data); return parent::addOption($attribute, $data); }
/** * Add option to select or multiselect attribute * * @param integer|string $attribute attribute ID or code * @param array $data * @return bool */ public function addOption($attribute, $data) { Mage::helper('Mage_Api_Helper_Data')->toArray($data); return parent::addOption($attribute, $data); }