I want a navigation menu build with a specific product attribute in magento 1.9.2 and product count will also show there like: Samsung (14) Hyundai (13) Asus (44)

Can any one great help me please and many many thanks in advance.

1 Answer 1


in /default/template/page/html/topmenu/renderer.phtml replace this line with this

$html .= '<a href="'. $child->getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'</a>';

with this

$cat_id = preg_replace("/[^0-9]/", '', $child->getID());
$products_count = Mage::getModel('catalog/category')->load($cat_id)->getProductCount();
$html .= '<a href="'. $child->getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $child->getBrand().($products_count) .'</a>';

$child->getBrand() replace Brand with you attribute name

  • Thanks Awadi, actually I am using 2columns-left template for my home page and changed the page.xml for showing page items as menu in topMenu and category items as menu in left sidebar. beneath the categories items menu I want to show Shop by Brand menu items where all my products are using Brand attribute. Commented Sep 9, 2016 at 17:30
  • In rwd/default/template/catalog/layer/view.phtml Brand items menu is showing now but didn't found any clues to view products count under each brand. <?php $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'brand'); if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(false); foreach ($options as $option) { echo '<li style="list-style:none"><a href="'.Mage::getUrl('catalogsearch/advanced/result').'?brand%5B%5D='.$option['value'].'">'.$option['label'].'</a></li>'; } } ?> Commented Sep 9, 2016 at 18:10

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.