Developer forum

Forum » Development » Get product category field values for product in C#

Get product category field values for product in C#

René Poulsen
René Poulsen
Reply

Hi,

Is there any way (in DW9) to get values of product category fields for a given product in C#?
I've got a Dynamicweb.Ecommerce.Products.Product object, but can't figure out how to get the values entered in the fields for the category the product belongs to.

 


Replies

 
Nicolai Pedersen
Reply

Hi René

On the product use GetCategories to find the product categories that applies to the product - loop them and the fields in these categories, and get the fieldvalues from product.GetCategoryValue

BR Nicolai

 
René Poulsen
René Poulsen
Reply

Hi Nicolai,

The documentation now says that this is obsolte (https://doc.dynamicweb.com/api/html/652024aa-c49c-8558-1600-1f8ea18996dc.htm) and that we should use ProductCategoryFieldService instead. I can't find any info on the ProductCategoryFieldService anywhere. Where is it? Or is it anywhere? Or do you have it? :-)

 
Martin Vang
Martin Vang
Reply

Hi Rene,

The ProductCategoryFieldService is actually completed, and is located in Ecommerce.Services.ProductCategoryFields. It is however, currently only friend, as I dont think it is in a state that is quite ready for release. The following services are "complete", but are currently undergoing serious refactoring (and thus, are still kept as friend/internal), because they do not meet my requirements for code quality:

    DiscountService
    OrderLineService
    OrderService
    ProductCategoryFieldService
    SalesDiscountService

They will be made public, as soon as this has been fixed.

Im sorry about the confusion in regards to the obsoleted methods - but using time to remove these, just to reintroduce them later, seems not worth the time.

Hope this explaination helps clear up the matter?

BR

Martin

 
René Poulsen
René Poulsen
Reply

Hi Martin,

Thank you for the answer. Do you have any estimate for when it will be in a state ready for release?

 
Sander
Reply
Original message by Martin Vang posted on 16/03/2018 09:12:24:

Im sorry about the confusion in regards to the obsoleted methods - but using time to remove these, just to reintroduce them later, seems not worth the time.

Why would the method be marked as obsolute in the first place, when the alternative isn't publicly available yet?

 

You must be logged in to post in the forum