Developer forum

Forum » Development » SetUnitPrice Overload doesnt set price or unitprice

SetUnitPrice Overload doesnt set price or unitprice

Theodor Perrier
Reply

SetUnitPrice(OrderLine orderLine, PriceInfo priceInfo, bool forcePriceRecalculation)

Doesnt update unitprice or price on orderline no error is thrown. Why does this happen?

 

DW version : 9.13.25


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Theodor,

This is a tricky one, because the method actually does update the unit price on the orderline (if the orderline type is not PointProduct). However, the orderline gives you a calculated unit price afterwards. I'm not entirely sure about the reason, but the SetUnitPrice methods no longer change the orderline type to reflect the fact that it now has a fixed unit price. I would argue that it's a bug, but it seems to have been removed on purpose. I'll follow up on that.

The solution, however, is fairly simple. Just before or right after you call SetUnitPrice, set the orderline type to Fixedorderline.OrderLineType = OrderLineType.Fixed;

I hope that helps.

- Jeppe

Votes for this answer: 1
 
Theodor Perrier
Reply

Hi Jeppe.
 

Oh, then it makes sence i couldn't find the issue. Thanks for det quick reply!
I agree that it should be reported as a bug, since the SetUnitPrice with forcePriceRecalculation = true, should re-calculate the price.

 

I haven't tried with your solution, but setting the unitprice with a double and then forceing the pricerecalculation triggered an update on the price.

 

You must be logged in to post in the forum