Magento News

 

Magento filter manufacturers by category

So I have a category called “backpacks” and I want to get all the manufacturers of backpacks. How do I accomplish this in Magento. Is this possible? The following code will get all manufacturers but how to I filter it down further. I am using Magento community 1.3.

$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);               

print_r($manufacturers);

Any advice would greatly help. I have search and search on Google. But I can’t seem to find a way to filter attributes by category. Because I believe that is what I am trying to do.

Magento filter manufacturers by category

Possibly Related Posts:


 

Leave a Reply