Get Associated Categories for Product

192 views Asked by At

I am new to Commerce Server development and I am facing one issue since few days and not able to find anything online.

Background: We have already working version of Catalog setup in Commerce Server 2009 and we are also using Commerce Server APIs to retrieve, modify catalog from SharePoint application.

Issue: Issue I am facing here is, I don't know how to retrieve 'Categories' associated with Products. One product can have 1 to many categories associated with it. I have product ID and I want to retrieve all the 'Categories' associated with product, or may be all category related information of the product. I looked up API and there are methods such as 'GetCategory', 'GetProduct' but information retrieved by these methods are not useful to me.

Question: Is there a way to retrieve categories associated with product? Any reason why this kind of method not in Commerce Server API?

Thanks a ton in advance!

1

There are 1 answers

1
bentayloruk On

Get a Product object by calling GetProduct and then access the property ParentCategoryNames to get a read-only collection of the product's parent categories. Additionally, there are several other Product properties that provide different category information (e.g. PrimaryParentCategoryName).