Developer forum

Forum » Development » Render Products

Render Products

Umar Farooq
Reply

Hi,

I am trying to load products in a view like this 

Dynamicweb.Ecommerce.Frontend.Renderer render = new Dynamicweb.Ecommerce.Frontend.Renderer();

 string sql = "SELECT * FROM EcomProducts WHERE CompatibleProducts LIKE '%@" + product.Id + "@%'";
 render.RenderProducts(Dynamicweb.Ecommerce.Products.Product.GetProductsBySql(sql), template, "Accessories");

I am running DW 9.4.12 (updated to this version) RenderProducts method is available which accept ProductCollection Argument but ProductCollection is depricated as well as GetProductsBySql() method. I can use ProductService to get all products and then filter products based on specific field but this is giving us a performance issue.

Is there any better way to handle this?

Best Regards

 


Replies

 
Nicolai Pedersen
Reply

Well, it is because my developers love to obsolete stuff too early.

Use productservice.GetProductsBySql() - will give you an ienurerable of products. Move them to a new ProductCollection that you create, pass it to rendering.

BR Nicolai

 
Umar Farooq
Reply

Hi Nicolai,

Thanks for the quick reply :)

As I mentioned productservice.GetProductsBySql() is also Deprecated. is this by mistake or on purpose?

BR umar

 

 
Nicolai Pedersen
Reply

Well, it is publicly available and will not be removed until DW10. Or maybe be re-introduced.

BR Nicolai

 

You must be logged in to post in the forum