S
S
Sergey2015-06-07 18:44:25
PHP
Sergey, 2015-06-07 18:44:25

How to find the parent category of a product on Open Cart?

What sql query can be used to find out the parent category of a product in Open Cart, knowing only the id of the product itself and the id of the subcategory in which it is nested? Open Cart Version 1.5.6

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
matperez, 2015-06-08
@matperez

Judging by the diagram , it will be something like:

SELECT p.* FROM category AS c LEFT JOIN category AS p ON c.parent_id = p.id WHERE c.id = :product_category_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question