コード例 #1
0
 /**
  * Retrive same attributes for selected products without unique
  *
  * @return Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
  */
 public function getAttributes()
 {
     if (is_null($this->_attributes)) {
         $this->_attributes = $this->getProducts()->getEntity()->getEntityType()->getAttributeCollection()->addIsNotUniqueFilter()->setInAllAttributeSetsFilter($this->getProductsSetIds());
         foreach ($this->_excludedAttributes as $attributeCode) {
             $this->_attributes->addFieldToFilter('attribute_code', array('neq' => $attributeCode));
         }
         $this->_attributes->load();
         foreach ($this->_attributes as $attribute) {
             $attribute->setEntity($this->getProducts()->getEntity());
         }
     }
     return $this->_attributes;
 }
コード例 #2
0
 /**
  * Clean up attribute collection.
  *
  * @param Mage_Eav_Model_Mysql4_Entity_Attribute_Collection $collection
  * @return Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
  */
 public function filterAttributeCollection(Mage_Eav_Model_Mysql4_Entity_Attribute_Collection $collection)
 {
     $collection->load();
     foreach ($collection as $attribute) {
         if (in_array($attribute->getAttributeCode(), $this->_disabledAttrs)) {
             $collection->removeItemByKey($attribute->getId());
         }
     }
     return $collection;
 }