Ejemplo n.º 1
0
 /**
  * @param Mage_Catalog_Model_Product $parent
  */
 public function setAttributes($parent)
 {
     $result = array();
     if ($this->getIsChild() && $parent->isConfigurable()) {
         /** @var Mage_Catalog_Model_Product_Type_Configurable $productTypeInstance */
         $productTypeInstance = $parent->getTypeInstance(true);
         $allowAttributes = $productTypeInstance->getConfigurableAttributes($parent);
         foreach ($allowAttributes as $attribute) {
             /** @var Mage_Catalog_Model_Product_Type_Configurable_Attribute $attribute */
             $itemAttribute = new Shopgate_Model_Catalog_Attribute();
             $attribute = $attribute->getProductAttribute();
             if ($attribute == null) {
                 continue;
             }
             $itemAttribute->setGroupUid($attribute->getAttributeId());
             $attrValue = $this->item->getResource()->getAttribute($attribute->getAttributeCode())->getFrontend();
             $itemAttribute->setLabel($attrValue->getValue($this->item));
             $result[] = $itemAttribute;
         }
     }
     parent::setAttributes($result);
 }