Showing posts with label Magento get Category product count. Show all posts
Showing posts with label Magento get Category product count. Show all posts

Wednesday, 7 January 2015

Get Category products count in Magento


Get Category products count in Magento

Try below code :

<?php
    $products = Mage::getModel('catalog/category')->load($_category->getId())
    ->getProductCollection()
    ->addAttributeToSelect('entity_id')
    ->addAttributeToFilter('status', 1)
    ->addAttributeToFilter('visibility', 4);
 
    echo $products->count();
?>