Developer forum

Forum » Development » Live Integration + Index

Live Integration + Index

Nuno Aguiar
Reply

Hi,

 

We are trying to extend the Live Integration VS project by adding additional info comming from the ERP other than the price (stock). The problem is that when using the index, we get the prices updates but not the other fields, which is understandable.

 

My question is, can we override a method that would enable us to update a the stock amount, which in turn would update the stock status?

 

If possible I would like to take it a step further updating other fields, keeping in mind that if I update field X and my index queries that field I would get bad/wrong results.

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

On Notifications.eCommerce.ProductList.BeforeRender notification you get the product collection and you can update it there. But we load stock information after that point.... So no, it is not possible....

So product template extender is the best way... In that, set the UnitStock, then call Dim stStatus As StockStatus = Product.StockStatus(Product.LanguageID) and pass in the result to RenderStockStatus(stStatus, Template).

​That should overwrite the templatetags with stockstates based on your stock levels

 
Nuno Aguiar
Reply

Hi Nicolai,

 

Thanks for the info. We'll git it a try.

 

Best Regards,

Nuno Aguiar

 
Gonçalo Assunção
Reply

Hi Nikolai,

I've tried your approach,but still I'm getting no results. Please check the attached print with my code.

The PrepareProductInfoProvider.changeStockStatus(product) method retrives the stockGroupId from the information received from the ERP.

In my local solution,I can debug it and check that I'm getting the results that we want. But in the dev site the stock status are not being rendered as they should be. The difference between both versions is that the index for the dev site has much more fields (stock included) than my local solution.

 

Thank you in advance

Extend_product_Template_C#.jpg
 
Nicolai Høeg Pedersen
Reply

You code is a ProductListTemplateExtender (the list of products being rendered). You should use the ProductTemplateExtender (the actual product being rendered).

This because of the order of which stock levels are set.

 

You must be logged in to post in the forum