Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 /**
  * 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);
 }
Esempio n. 3
0
 /**
  * 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);
 }