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
Hi product count comes from method name loadProductCount which is located at location code/core/Mage/Catalog/Model/Resource/Category/Collection.php
If you will dig in deep this count is coming from a join query between two tables: catalog_category_product and catalog_category_entity
I have fixed this issue by using event observer. you can do the same for time being. And let me know if you find any better solution.
public function deleteCountCategory (Varien_Event_Observer $observer) {
try {
$product = $observer->getEvent()->getProduct();
$productId = $product->getId();
$resource = Mage::getSingleton('core/resource');
$writeConnection = $resource->getConnection('core_write');
$tableName = $resource->getTableName('catalog_category_product');
$query = "DELETE FROM {$tableName} WHERE product_id = ".(int)$productId;
$writeConnection->query($query);
} catch (Exception $e) {
throw $e;
}
return $this;
}
Event used in config.xml
model
countfix/observer
deleteCountCategory