Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Changed behaviour in Product.GetPrice(currencyCode, countryCode)

Changed behaviour in Product.GetPrice(currencyCode, countryCode)

Jonas Krarup Dam
Reply

Hey,
I've just updated a solution from 9.10.x to 9.13.11, and afterwards, prices where wrong.

Specifically, prices in the EcomPrices table which reference a groups customer number in the PriceCustomerGroupID column no longer worked. 

I debugged into the dynamicweb code, and discovered that in the DefaultPriceProvider.FindPriceInternal, the UserID was no longer available. 

I seems that somewhere between those two versions, something was changed, and Product.GetPrice(currencyCode,countryCode) no longer looks at the current extranet user, but simply sets userID to 0.

This will break a lot of our solutions if/when we upgrade :-( 

I have a workaround for the current solution, but it would be great if we could avoid change of behaviour in the existing functionality, unless its absolutely needed.

Would you consider rolling back this change?

Thanks, Jonas


Replies

 
Nicolai Pedersen
Reply

Hi Jonas

I guess you are calling GetPrice directly? It is an obsolete method and the new overload should be used - though I can see there seem to be a change of behavior on that method (actually furhter down the stack).

Can you change to not use the obsolete method or is it a problem you would have on several solutions? We might be able to fix it by adding the userid in one of the obsolete methods in PriceManager.

The background of the change is that prices have been moved away from being dependent on all kind of context so prices can be fetched in context-independent situations like indexing, integration and web-api.

Let me know - thanks, Nicolai

 
Jonas Krarup Dam
Reply

Hey Nicolai,

yeah, this is our Espresso code that has this call, which means that any update to an Espresso solution will require code changes, or an upgrade to the espresso version. 

We can work around it, and I have on the solution that is currently seing the problem, but it would save us time during future upgrades, if we didn't have to. 

The refactoring sounds very sensible going forward - I fully support it for a major release ;-) 

I see that in the current DW code base, userID is simply set to 0 in the product.GetPrice() call -  would it maybe make sense to change that one to include the userID of the current user, and add a "getDefaultPrice()" or something, instead? I'm not sure if it would fix all possible problems, but it would fix this one for us :-) 

if not, we will have to live with the change :-)


Thanks Jonas

 
Nicolai Pedersen
Reply

Hi Jonas

The Product.GetPrice has not changed in many years - it is further down the stack the issue arrises. We can make this change in PriceManager where the call ends - also in obsolete methods, so it should be ok for us to do.

There is no need to create getDefaultPrice - the current GetPrice method is not being used by anything in Dynamicweb anymore - except Unit test.

 
Jonas Krarup Dam
Reply

Hey,

Sounds good, if it means product.getPrice will revert to the old behaviour :-) 

Will this be in the next release?

Thanks, Jonas 

 
Nicolai Pedersen
Reply
This post has been marked as an answer

I've merged it to Ecommerce for .13.* and .14.* - it will go into nuget and be in next Dynamicweb release as well.

Votes for this answer: 1
 
Jonas Krarup Dam
Reply

Beautiful, thanks

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Jonas

The Feature #9155 is part of Dynamicweb version 9.13.13 and 9.14.1

Kind Regards
Care Support
Kristian Kirkholt

 

You must be logged in to post in the forum