Developer forum

Forum » Integration » Liveintegration. productlist with variants takes a looong time. How to avoid this?

Liveintegration. productlist with variants takes a looong time. How to avoid this?

Jan Sangill
Reply

Hi,
I have a productlist with variants. When using live intregration and this - the call to the live integration is too big. 
I have this checked: "Include variants in productinfo request". I cant disable this, because then it wont work when we get to the basket and other places.
Is there a way I only on the productlist can avoid asking for variant prices? And in other context get the variant prices (in basket, productpage, other places)?

//jan


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Jan,

 

What are you using for the frontend? If it's Swift and using Lazy loading for Live Product Info, there is a know situation that is causing it and is planned to be refactored, reducing some of the properties being requested. It will also be easier to extend it, so you can add more data on the request without a lot of customizations.

 

Nuno Aguiar

 
Jan Sangill
Reply

Hi Nuno,
Its our own layout - not swift.
We are not using Lazy loading for Live Product Info.
In reality what I need to be able to do is on "certain" list - not include the calls for variants, but on others they need to be included - otherwise basket etc wont return correct price.

Any good ideas?

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi jan,

 

Well, you may run into a number of issues with this.

 

In theory you can subscribe to the Notifications.ProductInfo.OnBeforeGenerateProductInfoXml (or the OnAfterGenerateProductInfoXml) to manipulate your request and at that time check if you have any context. If the ProductId querystring parameter exists, then you are on the Product Detail page.

 

BUT, that may only work if you have caching per page and not session. Because now you can't use the same caching objects as the product list, because those will not have the variant information (assuming the user visits the product list before visiting the product detail page).

You'd also need to validate what the cached object will be if you have a variant in the cart, log out and then log back in, which will reload the cart and get data from live integration for those products (or wait until the cache is invalidated) to ensure you get the proper Live data navigating to the product lists and product detail pages afterwards.

 

So currently it is really hard to get different requests for the same product, depending on the caching settings (or caching all together). 

 

Hope that gets you a bit further away.

 

Nuno Aguiar

 
Jan Sangill
Reply

Hi Nuno. I agree. That sounds like a nightmare to workaround. The optimal appoach in future might be that it listens to the index I am using, telling to ignore variants - and then in other context not to ignore:)

Alot of what if's in the case of above.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Jan

Here is a suggestion from one of our developers: It is needed to implement some custom subscriber for “OnBeforeGenerateProductInfoXml” event and in it somehow based on some request page determination to remove the variant products from the passed “Dictionary<Product, double> products” parameter collection.

 
Jan Sangill
Reply

Hi, I will try and test this out. Ty for the input.

 

You must be logged in to post in the forum