Created
June 25, 2018 20:51
-
-
Save tinchodev/d4e3587565133594d13a84e7fa4473ab to your computer and use it in GitHub Desktop.
Fix magento product's categories tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE catalog_category_entity_tmp LIKE catalog_category_entity; | |
INSERT INTO catalog_category_entity_tmp SELECT * FROM catalog_category_entity; | |
UPDATE catalog_category_entity cce | |
SET children_count = | |
( | |
SELECT count(cce2.entity_id) as children_county | |
FROM catalog_category_entity_tmp cce2 | |
WHERE PATH LIKE CONCAT(cce.path,'%') | |
); | |
DROP TABLE catalog_category_entity_tmp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment