1

I am geting all dropdown attributes value and name using below code

    $product = Mage::getModel('catalog/product');  

 $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
     ->setEntityTypeFilter($product->getResource()->getTypeId())
     ->addFieldToFilter('attribute_code', 'manufacturer');

 $attribute = $attributes->getFirstItem()->setEntity($product->getResource());  

 $manufacturers = $attribute->getSource()->getAllOptions(false);

 foreach ($manufacturers as $manufacturer){


     echo $manufacturer_name = $manufacturer['label'];
    echo $manufacturer_value = $manufacturer['value'];



 }

i am also now how to get product from attributes for this i code this

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

$collection->addAttributeToSelect('manufacturer');


foreach($collection as $product){
    echo "<pre>";
 print_r($product->getData());
}

But My question is that I am create brand slider using manufacturer attributes (dropdown) and i am set image from using manufacturer label.

But i want to create when click on manufacturer label(xyz) this it will display all product where set (xyz) in product list.

1 Answer 1

0

Try

$collection = Mage::getModel('catalog/product')->getCollection()
                   ->addAttributeToFilter('manufacturer', array('eq' => 'xyz'))
                   ->addAttributeToSelect('*'); 
5
  • I am set this code but no result found.
    – coder
    Aug 22, 2014 at 14:57
  • Take a look at stackoverflow.com/questions/1332742/… Aug 22, 2014 at 14:59
  • Are you using the value (manufacture name) or the id (magento id)? Aug 22, 2014 at 15:00
  • i am trying with manufacture name and i also try with manufacture id
    – coder
    Aug 23, 2014 at 3:40
  • yes it's working my mistake it's not working thanks
    – coder
    Aug 28, 2014 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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