Hello everybody, this is my first post here.
I just deleted all of my products in my Magento 2.3.4 but still i see numbers next to my subcategory's. When i go to catalog / Category..
How can this be and how can i solve this?
as you can see, i have 0 products..
What can i do to make these numbers go away?
thank you very much for your help.
Kind regards,
Andy
Solved! Go to Solution.
Hi @andyavcons30c7
You can try the below query to clear the data from category mapping table.
To make sure the results. select * from catalog_category_product where product_id not in (select entity_id from catalog_product_entity);
To delete the records.
delete from catalog_category_product where product_id not in (select entity_id from catalog_product_entity);
If you are using prefix for table then change table name accordingly.
I hope it will help you in future as well!
Hi Andy
Have you cleared your cache and reindexed?
Reindexing will most likely solve your issues as it will "recount" all of the products in the category and show the correct number.
Thx @Rixxo i tried this in ssh with this code
php bin/magento indexer:reindex
and then with
php bin/magento cache:clean
but he's still showing the number of products that aren't there :-)
Would it be an option to delete everything in these table? mg_catalog_category_product ? in the sql? i see that there a still a lot of id's in there
Ok, i deleted everything in mg_catalog_category_product and it worked :-) everything is back to 0.. yesss
Hi @andyavcons30c7
You can try the below query to clear the data from category mapping table.
To make sure the results. select * from catalog_category_product where product_id not in (select entity_id from catalog_product_entity);
To delete the records.
delete from catalog_category_product where product_id not in (select entity_id from catalog_product_entity);
If you are using prefix for table then change table name accordingly.
I hope it will help you in future as well!