$_productCollection = Mage::getModel('catalog/product')->getCollection(); $_productCollection->addAttributeToFilter('brand', array('in' => array(11))); $_productCollection->addAttributeToSelect('*'); $_productCollection->load();
Saturday, September 10, 2011
How to get product collection based on attribute (manufacturer, brand) values in magento?
Here is the code to get products based on attribute values. For example here I used to show products based on attribute "brand". In brand attribute I have values nike, adidas. 11 is the code for nike. I here used to display only nike products.
Labels:
attribute,
brand,
collection,
get,
Magento,
manufacturer,
product
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment