Know Magento
yet another magento blog
Tag Archives: Manufacturer
Add Manufacturer block in Magento
May 23, 2011
Posted by on To add the Manufacturer block in Magento is very easy. Just follow the steps mentioned bellow.
Create a new template file manufacturer.phtml in app/design/frontend/default/<your_template>/template/catalog/navigation/
(if you are not able to find catalog or navigation directory in template then please create them in respective order)
Put the following code in manufacturer.phtml
<ul> <?php $collection = Mage::getResourceModel('catalog/product_attribute_collection') ->addFieldToFilter('attribute_code', array('eq'=>'manufacturer')) ->addStoreLabel(Mage::app()->getStore()->getId()) ->load(); foreach($collection as $a){ $manufArray = $a->getSource()->getAllOptions(false); foreach($a->getSource()->getAllOptions(false) as $option) $manufArray[$option['value']] = $option['label']; } asort($manufArray); foreach($manufArray as $menKey => $menVal) { if(is_array($menVal)) { continue; } echo '<li><a href="'.Mage::getURL().'catalogsearch/advanced/result/?manufacturer%5B%5D='.$menKey.'">'.$menVal.'</a></li>'; } ?> </ul>