Write down the following code in list.phtml If you want to show total numbers of products in a particular category
<?php //$_productCollection = $this->getLoadedProductCollection();// already define at the begning $count = $_productCollection->getSize(); if($count>1){ echo $count." Items Found"; } else{ echo $count." Item Found"; } ?>
Get total number of items of a category in view.phtml
<?php $_helper = $this->helper('catalog/output'); $_category_detail=Mage::registry('current_category'); //echo $_category_detail->getName(); //gives current category name //echo $_category_detail->getId(); //gives current category id $products_count = Mage::getModel('catalog/category')->load($_category_detail->getId())->getProductCount(); echo($products_count); ?>
0 Comments