Developer forum

Forum » PIM » Feeds with live pricing

Feeds with live pricing

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a solution running 9.9.6 and I need to create a feed for partners.

The feed should include Live prices.

How do I do it?

So far I have tried setting up the feed (I have actually used a feed already set up from Rapido) and I have selected a customer from the list.

If I add a Price field, I get System.NullReferenceException: Object reference not set to an instance of an object.

I have checked in the template and it does not seem to initiate the User object and therefore the calls to LiveIntegration are for Anonymous users.

How do I solve it? I remember there was a mention at some point that the PIM Feeds should support Live Prices.

Thank you,
Adrian 


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Adrian,

Please, try to use at least last DW9.9.8 where I was not able to catch the issue. PIM JSON feed set up for specific user outputs price corresponds to the user from product price matrix correctly.

BR, Oleg QA 

 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Oleg,

Thank you for the suggestion.,

I have upgraded to the latest 9.9 version and I got rid of the error.

But I still don't get prices. I get NaN for all prices.

Adrian

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,
it is not clear what are your steps. Problem is that I don't know how the feeds for PIM works, could you describe with more details of how do you do the setup and what are your
urls for the feed, etc?
Could you set in the Live integration "Live product info for anonymous users"?
Thx
Kind regards, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,

I am using a Feed that is part of the Rapido setup.

Namely, the Partner feed (XML)

This is the link that is generated: https://gf.dotfusion.ro/dwapi/Feeds/GetFeedOutput?Id=2&languageId=LANG1&currencyId=RON&shopId=SHOP1&UserId=jxi5FU%2b1g%2fg%3d

And my aim is to include personalized pricing in this field instead of prices for anonymous users. That's why I have not checked the "Live product info for anonymous users".

In the above feed, I have set up a customer and I have confirmed that the customer has prices for products when browsing the website.

Thank you,

Adrian

 

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

I found further information on this. I'm running into the same issue, on 9.9.4. 

I believe that the issue is with Live Integration. It's possibly caching a null value for the price for one of the fields. But, the feed provider should at least handle for that and provide a better error message so that we know where to look next.

Here's an example that is currently failing with that error: https://sandbox.biolegend.com/dwapi/Feeds/GetFeedOutput?Id=2&languageId=LANG1&currencyId=USD

The stack trace suggests that it has something to do with GetCurrentExtranetUserId() within GetPrice().

<pre class='dw-error'>Error executing template "Feeds/Json.cshtml"
Newtonsoft.Json.JsonSerializationException: Error getting value from &#39;Price&#39; on &#39;Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel&#39;. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUserId()
   at Dynamicweb.Ecommerce.Prices.DefaultPriceProvider.&lt;&gt;c__DisplayClass6_0.&lt;PreparePrices&gt;b__0(Product product)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Dynamicweb.Ecommerce.Prices.DefaultPriceProvider.PreparePrices(IEnumerable`1 products)
   at Dynamicweb.Ecommerce.Prices.PriceManager.PreparePrices(IEnumerable`1 products)
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.PreparePrices(Boolean&amp; pricesHasBeenPrepared, Object lock, IList`1 products)
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.&lt;&gt;c__DisplayClass0_2.&lt;BulkCreateView&gt;b__31()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at GetPrice(Object )

Thanks,

Scott

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Skott,

The exception seems to be the know bug (DevOps 1423, reproduced if a price property is selected in feed even on a regular solution) caught on DW9.10 as well, it has already been fixed with Dynamicweb.Ecommerce.1.10.28 version and will be provided by upcoming DW release.

BR, Oleg QA 

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Oleg,

Amazing! Glad to hear that you knew about this already and have already resolved this. I'll try it out on Dynamicweb.Ecommerce.1.10.28.

Scott

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Oleg,

Any ETA on this fix? I have 2 projects waiting for it. Both are on the 9.9.x branch.

Thank you,


Adrian

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi

You can already at use the package version mentioned above, at least, to have the fix, download it from Nuget and unzip the 'dll' against awaiting for upcoming DW9.10.6 release. Note that it can be used on DW9.10 solution only, no DW9.9 fix is planned.

BR, Oleg QA

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Oleg,

This is pretty bad news. I was hoping to get a fix for 9.9.x.

My solutions cannot yet be upgraded to 9.10 since I've noticed there are still reports of breaking changes.

How do I solve it? I imagine I am not the only one using 9.9 with this functionality.

Thank you,
Adrian

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Adrian

DevOps 1423 was submitted against the error on DW9.10 only, since last DW9.9 (9.9.8) is OK without the fix and outputs prices in feed (XML without XSLT&JSON) correspond to user set in feed settings against one in product price matrix correctly. Scott said about fail on 9.9.4 but not on last DW9.9.8 If you have 'NaN' value for 'Price' property in XML output with XSLT then try to select 'Number' and 'PriceBeforeDiscount' properties in 'Parameters-Product system fields'. I was able to fix the issue using e.g. 'channable_products_transformer.xslt'

BR, Oleg QA

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi,

besides, and I see your feed mentioned below outputs products having no price matrix and with general price is 0. I've tried to check the feature using the updated product (pls, remove my price matrix and other proofs added) and saw it's OK Other issues can be releated to integration only in my view.

BR, Oleg QA

 

2021-04-15_13-16-04.png 2021-04-15_13-17-47.png 2021-04-15_13-20-02.png 2021-04-15_13-26-07.png
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

If it helps any, this is working for me now on 9.10.7. However, when re-reading my post above, I may have mistyped. I believe that it was failing on 9.10.4 (not 9.9.4). Hopefully that didn't cause too much confusion. 

Scott

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Oleg,

In my case, I am using 9.9.8 with the standard feed that comes with Rapido.

Partner feed (XML) with the Channable XSLT.

The link is here: https://gf.dotfusion.ro/dwapi/Feeds/GetFeedOutput?Id=3&languageId=LANG1&currencyId=RON&shopId=SHOP1&UserId=jxi5FU%2b1g%2fg%3d

As you can see, I get a NaN value for prices. I am using a User where I need to get Live prices. Not Price Matrix.

I have selected Number and PriceBeforeDiscounts but nothing changed.

Thank you,

Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Oleg,

Any updates on this?

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Oleg,

I really need a solution to this problem.

The documentation clearly states that Live pricing should be supported by the feeds:

  • (Optional) Select a specific user/account to fetch data for- this is typically used to fetch customer-specific stock and prices on solutions with price matrix prices or an active live integration

My customers have seen this and requested us to implement it. I cannot find excuses anymore. Please help me find a solution to this issue.

Thank you,

Adrian 

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply
Hi, please, submit case to support if still relevant to have deep research and fix by live integration team. BR, Oleg QA
 
Søren Jensen Dynamicweb Employee
Søren Jensen
Reply

Hi Adrian,

We are setting up a solution, to simulate and debug what is going wrong with Live data.

I will come back to you a.s.a.p.

/Søren

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

Thank you very much. I have also submitted a message to the support desk.

Thank you,


Adrian

 
Steffen Kruse Hansen Dynamicweb Employee
Steffen Kruse Hansen
Reply

Hi Adrian,

We have looked a bit deeper into this, and unfortunately, there are some issues that need to be taken care of, because live pricing will work out of the box with PIM feeds and WebApi, because the LiveIntegration need some context information, which it can't get without using the Common.Context and GetExtranetUser, which is not available from neither Feeds or WebApi. We will try to look into solving these issues, but it's not a small task, and they come with a risk of breaking some functionality, so we don't want to rush into it.

BUT... Since we understand that your customer expects this functionality to work, and we want to help you, we have found a way, where it can actually be done by making some minor changes in the LiveIntegration dll. We idea behind this workaround is simply to read the context information from the URL parameters inside the LiveIntegration, which should only be available when you are in a PIM feed. That way you can use the URL parameters as a fallback in the LiveIntegration, and use that to get the User, Shop, Language or Currency.

Since LiveIntegration dlls are often customized, I can't give you a full working example, but if the description above is not clear, I can provide you with the source code for a LiveIntegration that has the changes I needed to make it work. So just let me know.

I hope it makes sense, and sorry for the inconvenience.

Best regards,

Steffen
 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Steffen,

I understand the challenges. Until you figure out a standard solution, I am fine with looking into a sample code for LiveIntegration.

If you can provide some sample code, I am sure we can work something out.

Thank you very much for looking into it,


Adrian

 
Steffen Kruse Hansen Dynamicweb Employee
Steffen Kruse Hansen
Reply

Hi Adrian,

I have provided the source code containing the necessary changes to Support, and they said they will handle the rest of the communication since they have a case, so it's probably better to keep the communication one place.

But in case you have any questions, just let me know.

Best regards,

Steffen

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Steffen,

Thank you very much. I have received the code.

Thank you,

Adrian

 

You must be logged in to post in the forum