B-219 Sec-55 Noida, India
+918010221733

Magento : Product count in a category.

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();
?>

(Visited 42 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.