Shop by brand

Tweet, share & co

tweet fb share g+ share

Tags


Description

Shop by brand, for example in the sidebar.

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

<ul id="manufacturer_list">
<?php foreach ($manufacturers as $manufacturer): ?>
<li>
<a href="http://www.yourdomain.com/catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>">
<?php echo $manufacturer['label'] ?>
</a>
</li>
<?php endforeach; ?>
</ul>

Comments