コード例 #1
0
 /**
  * prepare attribute groups
  *
  * @return array
  */
 protected function prepareAttributeGroups()
 {
     $result = array();
     if ($this->currentProduct->hasAttributes()) {
         //function getAttributesInformationsByProduct available from version 1.5.0.1
         if (version_compare(_PS_VERSION_, '1.5.0.1', '<')) {
             $attributes = BWProduct::getAttributesInformationsByProduct($this->currentProduct->id, $this->getPlugin()->getLanguageId());
         } else {
             $attributes = Product::getAttributesInformationsByProduct($this->currentProduct->id);
         }
         $addedGroup = array();
         foreach ($attributes as $attribute) {
             if (!in_array($attribute['id_attribute_group'], $addedGroup)) {
                 $attributeItem = new Shopgate_Model_Catalog_AttributeGroup();
                 $attributeItem->setUid($attribute['id_attribute_group']);
                 $attributeItem->setLabel($attribute['group']);
                 $result[] = $attributeItem;
                 $addedGroup[] = $attribute['id_attribute_group'];
             }
         }
     }
     return $result;
 }