Reputation: 143
I created one attribute brand with values 'only' and 'unbranded'. Now I want to filter product list by brand names for customer. I tried following code
In local/Mage/Catalog/Block/Product/Newlist.php
class Mage_Catalog_Block_Product_Newlist extends Mage_Catalog_Block_Product_Abstract
{
protected function _getProductCollection()
{
$collection = parent::_getProductCollection();
$collection->addAttributeToSelect('brand')
->addAttributeToFilter('brand', array('eq' => 'only'))
;
return $collection;
}
}
Upvotes: 0
Views: 1440
Reputation: 143
I have solved this using following code
$_productCollection->clear()
->addAttributeToFilter(array(
array('attribute'=> 'brand','eq' => 'Only'),
array('attribute'=> 'brand','eq' => 'VeroModa'),
)
->load();
Upvotes: 3