I have a strange issue and seems many are having the same on internet. Below picture will define my issue and also my magento version is 1.7
A simple solution to this is go to app/code/core/Mage/Catalog/Model/Category.php
or it's better to create a local file so that it doesn't effects while magento upgrade. So create app/code/local/Mage/Catalog/Model/Category.php
In this model create a new function say getFrontentProductCount()
public function getFrontentProductCount()
{
$collection = Mage::getResourceModel('catalog/product_collection')
->addCategoryFilter($this);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
return $collection->count();
}
Now go to your template phtml file where you execute your category product count. In general case it's: theme/template/catalog/navigation/left.phtml
now call the above function as required, like:
getIsActive()): ?>
-
isCategoryActive($_category)): ?> class="current">htmlEscape($_category->getName()) ?> (getFrontentProductCount() ?>)