Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the requirement of oc_category_path table exists in opencart?

I am unable to understand the concept of having category_path table in opencart. Can any opencart expert here explain with a scenario/example?

like image 956
Rakesh Avatar asked Mar 17 '23 03:03

Rakesh


1 Answers

The category_path table stores data relating to the category hierarchy. For instance, suppose you have top level category "Shoes" with category_id 7. "Shoes" has a sub category called "Gators" with category_id 11. In the admin panel you would see something like:

Shoes > Gators

The category_path table would have rows like:

+-------------+---------+-------+
| category_id | path_id | level |
+-------------+---------+-------+
|          11 |       7 |     0 |
|          11 |      11 |     1 |
+-------------+---------+-------+

The row where the path_id is equal to the category_id tells you how many levels deep the category is. The other rows show it's parents and their respective level.

like image 152
Eaten by a Grue Avatar answered Apr 28 '23 13:04

Eaten by a Grue