Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

magento showing wrong product count in category

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

enter image description here

As I have highlighted, LEFT says the category has 16 products, but in actual the Category Products Tab shows 15 products. All my categories are messed up. Please let me know what's going wrong. I've tried disabling the cache, but it didn't worked.

[Edit]

I tried removing one-product from the category, then the number on the left went to 15 and total records 14. So I thought may be a product whose is disabled in there in this category. But when I searched for disabled products none were there.

like image 587
coding_idiot Avatar asked Feb 08 '13 16:02

coding_idiot


Video Answer


1 Answers

This will fix them all.

DELETE FROM 
catalog_category_product 
where product_id NOT IN (SELECT entity_id FROM (catalog_product_entity)) 

Then, implement the solution in the observer to keep it from happening again.

like image 114
CarComp Avatar answered Oct 04 '22 00:10

CarComp