I have a lot of products on database, and every single one has a single category asociated, now I want to assign every category parent linked with its current category children. For example, in the case of sunglasses, I would like to associate the "Accesories" categories to it, because the current category of sunglasses is "Eyewear", because is the category child of "Accessories". I could do this with 5 or 10 products, but I have hundreds, so I want to do this by code, my little problem now is I can't identify the table with the category parent-children association.

2 Answers 2


You can find category parent-children association in table catalog_category_entity in column path. It show full category tree path: category ids joined by / delimeter.

At screenshots you can find Living Room category with id 22. At the first screen tree in admin side. And at the second path in db table.

Category path DB structure


The table I was looking for is catalog_category_entity. The table has a parent_id field (a self referencing foreign key) and a path field, which has its complete category tree separated by slashes. This is all the information I need in order to write my code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.