Hi DW,
I have an OrderlineExtender where I set the unitprice of my orderline.
For instance:
base.OrderLine.SetUnitPrice( base.OrderLine.Price.Price * 0.8 );
Doing this doens't update the calculation of the order total.
Should i be updating the price somewhere else? Or do i need to change more SetUnitPrice?
// Martin
Developer forum
E-mail notifications
How to set new Order.TotalPrice
Martin Nielsen
Posted on 15/09/2011 15:58:18
Replies
Jeppe Eriksson Agger
Posted on 16/09/2011 14:03:46
This post has been marked as an answer
Hi Martin
You are correct, this is due to internal price caching in the Order object. I have created an item in our backlog for this, and it should be out in the next service release.
In the meantime, you can use the code in my next post as a workaround until the permanent fix is in. It utilizes a property on the Order class called AllowOverridePrices, but I would only recommend this as a temporary fix because you have to add fees to the price manually.
You are correct, this is due to internal price caching in the Order object. I have created an item in our backlog for this, and it should be out in the next service release.
In the meantime, you can use the code in my next post as a workaround until the permanent fix is in. It utilizes a property on the Order class called AllowOverridePrices, but I would only recommend this as a temporary fix because you have to add fees to the price manually.
Hope this helps :)
- Jeppe
Votes for this answer: 0
Jeppe Eriksson Agger
Posted on 16/09/2011 14:03:56
base.OrderLine.SetUnitPrice(base.OrderLine.Price.Price * 0.5); var price = base.Order.PriceBeforeFees.Add(base.Order.PaymentFee).Add(base.Order.ShippingFee); base.Order.AllowOverridePrices = true; base.Order.Price.PriceWithoutVAT = price.PriceWithoutVAT; base.Order.Price.PriceWithVAT = price.PriceWithVAT; base.Order.Price.VAT = price.VAT;
You must be logged in to post in the forum