public function testAddAttributeGrouping() { $select = $this->_model->getSelect(); $this->assertEmpty($select->getPart(Zend_Db_Select::GROUP)); $this->_model->addAttributeGrouping(); $this->assertEquals(array('main_table.attribute_id'), $select->getPart(Zend_Db_Select::GROUP)); }
/** * Return collection of same attributes for selected products without unique * * @return Mage_Eav_Model_Resource_Entity_Attribute_Collection */ public function getAttributes() { if (is_null($this->_attributes)) { $this->_attributes = Mage::getSingleton('Mage_Eav_Model_Config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection()->addIsNotUniqueFilter()->setInAllAttributeSetsFilter($this->getProductsSetIds()); if ($this->_excludedAttributes) { $this->_attributes->addFieldToFilter('attribute_code', array('nin' => $this->_excludedAttributes)); } // check product type apply to limitation and remove attributes that impossible to change in mass-update $productTypeIds = $this->getProducts()->getProductTypeIds(); foreach ($this->_attributes as $attribute) { /* @var $attribute Mage_Catalog_Model_Entity_Attribute */ foreach ($productTypeIds as $productTypeId) { $applyTo = $attribute->getApplyTo(); if (count($applyTo) > 0 && !in_array($productTypeId, $applyTo)) { $this->_attributes->removeItemByKey($attribute->getId()); break; } } } } return $this->_attributes; }
/** * Return array of fields to load attribute values * * @return array */ protected function _getLoadDataFields() { $fields = array_merge(parent::_getLoadDataFields(), array('additional_table.is_global', 'additional_table.is_html_allowed_on_front', 'additional_table.is_wysiwyg_enabled')); return $fields; }
/** * Clean up attribute collection. * * @param Mage_Eav_Model_Resource_Entity_Attribute_Collection $collection * @return Mage_Eav_Model_Resource_Entity_Attribute_Collection */ public function filterAttributeCollection(Mage_Eav_Model_Resource_Entity_Attribute_Collection $collection) { $collection->load(); foreach ($collection as $attribute) { if (in_array($attribute->getAttributeCode(), $this->_disabledAttrs)) { $collection->removeItemByKey($attribute->getId()); } } return $collection; }
protected function _construct() { parent::_construct(); }