Get / filter all products by attribute value
Get all products related to any particular brand. Let us suppose that we are fetching the products related to ‚Apple‘ brand. The manufacturer ID of Apple = 3.
$manufacturerId = 3; $attributeCode = 'manufacturer'; $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter($attributeCode, $manufacturerId); // print all products print_r($products->getItems());