Below are the 2 different way to display the product count in the category in magento.
<?php
$catObj = Mage::getModel(‘catalog/category’)->load($_category->getID());
$prodObj = $catObj->getProductCollection()->getData();
echo count($prodObj);
———————-OR————————–
$prodCollection = Mage::getResourceModel(‘catalog/product_collection’)->addCategoryFilter($_category);
echo $prodCollection->count();
?>
No comments:
Post a Comment