Developer forum

Forum » Development » Getting Products from Assortments

Getting Products from Assortments

Daniel Hollmann
Reply

Hi.

We have a solution that we are upgrading from v. 9.8 to v.9.14.

We have are using Ecommerce and Assortment.
We used to use the GetAssortmentItemsByAssortmentId method, of the AssormentService class to get the products related to the assortment. After the upgrade it started to get some weird values out, and I can see in the documentation that the method is not Obsolete.
So my question is how do I then get the related products to a Assortment. I looked around the documentation and I can’t find a good method for this? Even the GetAssortmentById(String) that returns a assortment does not have a relation to the products?

Also we ServiceLocator for getting a not of the Dynamicweb services, but for products and assortments we just create a new service like this.

    var assortmentservice = new Dynamicweb.Ecommerce.Assortments.AssortmentService();

    var productservice = new Dynamicweb.Ecommerce.Products.ProductService();

Is there a better way of getting the two services?


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Daniel

Always get the service instance from Dynamicweb.Ecommerce.Services.*

Use the Assortment class to get the items = products.

BR Nicolai

 
Daniel Hollmann
Reply

Thanks. The solution I'm working is before the Dynamicweb.Ecommerce.Services.* were available so a lot of 
the weird errors.

 

You must be logged in to post in the forum