I have this web site with the main menu (drop down effect) on my frontpage/homepage. In the main menu I have 7 different categories for my products. All categories are linked to category's pages, and that is absolutely OK.

I would like it to show how many products are in the specific category (number of total items in category, right beside the link).

for eample: Shirts (10)

  • define which theme u can use? Commented Oct 22, 2014 at 11:54

4 Answers 4


Display product count in top menu see hear

Magento categories marked as 'Include in menu' are added by page_block_html_topmenu_gethtml_before event observer function addCatalogToTopmenuItems located in

app/code/core/Mage/Catalog/Model/Observer.php to 


Lets overwrite it:

enter image description here

Only for subcategory menu on top

enter image description here

  • Ravi thanks for effort. I'm not using default menu and theme, it is custom made theme, i just need to display product count for specific category (lets say id category is 4).
    – haver15
    Commented Oct 22, 2014 at 11:45
  • more idea to go for category code. base\default\template\catalog\navigation\left.phtml Commented Oct 22, 2014 at 11:47

I found a solution to this.

Bellow is a code which is working in my case:

$products_count = Mage::getModel('catalog/category')->load(4)

where "4" is the id of the wanted category.

thanks to Ravi Patel for his effort one more time.

  • it working thank you
    – SNS
    Commented Oct 14, 2017 at 13:09

you can get category product count by below code


$categoryId = 'YOUR_CATEGORY_ID';
$products_count = Mage::getModel('catalog/category')->load($categoryId)->getProductCount();

$collection = Mage::getModel('catalog/category')->getCategories($catid);

 * looping through sub categories
 * only showing active sub categories ($cat->getIsActive())
foreach($collection as $cat) {
    if($cat->getIsActive()) {
        $category = Mage::getModel('catalog/category')->load($cat->getEntityId());

        $prodCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($category);


        <a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?></a> (<?php echo $prodCollection->count() ?>)<br/>



  1. New Arrivals (14)
  2. Tops & Blouses (21)
  3. Pants & Denim (8)
  4. Dresses & Skirts (22)

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.