Developer forum

Forum » Development » Use 'ProductService.GetProductByNumber' instead

Use 'ProductService.GetProductByNumber' instead

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

It might be a stupid question to ask, therefore I appologise in advance.

I am trying to get a product based on the PrductNumber.

I have searched the APi and found a method (Product.GetProductByNumber) that is marked as Obsolete.
In order to avoid revisiting the code in the future, I would like to use the new and approved method that is future-proof.
I have found this recommendation [ObsoleteAttribute("Use 'ProductService.GetProductByNumber' instead")] but I could not figure out how to use it.

The only reference to ProductService that I could find was in a namespace called Synchronization (or something similar).

Can you point me in the right direction?

Thank you,

Adrian


Replies

 
Steffen Kruse Hansen Dynamicweb Employee
Steffen Kruse Hansen
Reply

Hi Adrian,

You should be able to access the ProductService through Dynamicweb.Ecommerce.Services.Products. So when you need the 'GetProductByNumber' methlod, you need Dynamicweb.Ecommerce.Services.Products.GetProductByNumber.

Best regards,

Steffen

 
Nicolai Pedersen
Reply

Steffen, that is 9.4 that you can use the ProductService.

In 9.3 you still need to use Product.GetProductByNumber.

I am aware that the API docs build based on our development branch and not the release branch and that can cause some issues. We are looking into that. Sorry about the inconvenience.

BR Nicolai

 

You must be logged in to post in the forum