i am trying this code

$manufacturerId = 28;
$attributeCode = 'manufacturer';
 $products = Mage::getModel('catalog/product')
                ->addAttributeToFilter($attributeCode, $manufacturerId);

// print all products
echo "<pre>"; print_r($products->getItems()); echo "</pre>";


but get real solution

output of this code is


how can i get product list by manufacturer name


Here is one way to do it where you cycle through the options of the attribute and get a product collection for each one:

$name = 'manufacturer';
$attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter($name)->getFirstItem();
$attributeId = $attributeInfo->getAttributeId();
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
$attributeOptions = $attribute ->getSource()->getAllOptions(false);

foreach ($attributeOptions as $_option){
    echo $_option['label'];

    $productcollection = Mage::getModel('catalog/product')->getCollection()
        ->addAttributeToFilter($name, $_option['value']);

    foreach ($productcollection as $_product){
        echo $_product->getName();

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.

  • it's just give me manufacturer name only i didn't get any product Jan 20 '15 at 5:41
  • Updated the product collection to include the attributes for use in outputting.
    – Jasuten
    Jan 20 '15 at 5:45

You can Try this:-

 $collection = Mage::getModel('catalog/product')->getCollection();

// print all products

echo "<pre>"; print_r($collection->getData()); echo "</pre>";
$products = Mage::getModel('catalog/product')
                    ->addAttributeToFilter($attributeCode, $manufacturerId);

In your code Items() did not give the result.

Please use getAllIds() function it give all manufacturer type 28

  • Welcome to SE. Its good to describe the solution you are providing
    – Priyank
    Aug 23 '17 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.