Get all categories for a product

Hi,

I have one product that is assigned to many categories.

How can i get all the categories the product is assigned to based on productId?

Thanks

Hi :slight_smile:

You can get all the categories the product is assigned to based on productId with the query


select *
from oxobject2category 
left join oxv_oxcategories_de on oxv_oxcategories_de.oxid=oxobject2category.oxcatnid  
where oxobject2category.oxobjectid = 'productId' and oxv_oxcategories_de.oxid is not null 

This query is from the file /application/controllers/admin/article_extend_ajax.php => // all categories article is in

Best wishes
indianer3c