i am trying this code
<?php
$manufacturerId = 28;
$attributeCode = 'manufacturer';
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter($attributeCode, $manufacturerId);
// print all products
echo "<pre>"; print_r($products->getItems()); echo "</pre>";
?>
but get real solution
output of this code is
Array
(
)
how can i get product list by manufacturer name
Best Answer
Here is one way to do it where you cycle through the options of the attribute and get a product collection for each one:
This way is a bit slow so you may prefer to instead load a collection of all products and then sort them by the manufacturer attribute.