Oxid - Get product categories based on article id

1.3k Views Asked by At

I have an product that is assigned to more than 1 category.

I am interested how can i select all the categories that the product is assigned to based on productID.

something like get Article Categories (id Article)

1

There are 1 best solutions below

0
On BEST ANSWER

It's possible to get category ID's by using oxArticle::getCategoryIds(), but you have to have article object loaded like:

$oArticle = oxNew('oxarticle');
$oArticle->load('id');
$aCategories = $oArticle->getCategoryIds();

If you need objects just foreach to load them.