Magento – Fix Sub-Categories Not Showing in Category Tree

categoryproducts-management

I am using magento copy category extension, this extension copies categories successfully.

But on Manage Product page in Categories tab, sub-categories of the original category (that i copied) disappears from the category tree. The copied categories are ok. But when i add a sub category manually to the original category, it solves the problem and subcategories appears.

It shows that sub-categories were not disturbed by the module but problem arises from somewhere else.

Any Suggestions?

Edit

Category page-Fine
Product Page- Error

Thanks in advance for your help

Best Answer

Maybe there is inconsistency data which was caused by custom module.

You can check catalog table catalog_category_entity with help of query

SELECT c.entity_id, c.children_count as original_children_count, COUNT(c2.children_count) as `children_count`, c.level as original_level, (LENGTH(c.path)-LENGTH(REPLACE(c.path,'/',''))) as `level`
FROM catalog_category_entity c
LEFT JOIN catalog_category_entity c2 ON c2.path like CONCAT(c.path,'/%')
GROUP BY c.path

and if it will needed (just compare results), then fix with help of following query

INSERT catalog_category_entity(`entity_id`,`children_count`, `level`)
SELECT c.entity_id, COUNT(c2.children_count) as `children_count`, (LENGTH(c.path)-LENGTH(REPLACE(c.path,'/',''))) as `level`
FROM catalog_category_entity c
LEFT JOIN catalog_category_entity c2 ON c2.path like CONCAT(c.path,'/%')
GROUP BY c.path
ON DUPLICATE KEY UPDATE `children_count` = VALUES(`children_count`), `level` = VALUES(`level`);
Related Topic