1

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!

Mayank
  • 13
  • 4

1 Answers1

1

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).

bentayloruk
  • 4,060
  • 29
  • 31
  • Thanks a lot for your reply. I was able to find PrimaryParentCategoryName from GetProduct method call but somehow I am not able to see ParentCategoryNames, ParentCategories properties being returned. I checked commerce server service reference and noticed it is returning Microsoft.CommerceServer.Catalog.XmlData.Product object and NOT the Microsoft.CommerceServer.Catalog.Product object. I think I will be able to resolve my issue with your suggestion once I get right Product object from GetProduct method. – Mayank Jun 27 '14 at 20:03