Developer forum
E-mail notifications
OrderLineType an AllowOverridePrices
Konstant van der Linden
Posted on 13/02/2012 15:45:14
If I use AllowOverridePrices = true on a Cart OrderLine is the line OrderLineType then automatically and immutable OrderLineType.Fixed?
If so how can I distinguish between a product and a discount?
What other effect has the use of AllowOverridePrices?
Replies
Jeppe Eriksson Agger
Posted on 14/02/2012 13:54:47
Hi Konstant
Setting AllowOverridePrices to true will not have any effect on the OrderLine.Type property. The only thing AllowOverridePrices does is: if set to true, you get the internal PriceInfo object back when accessing the Price property of the OrderLine.
If you experience that the Type of the OrderLine changes then I can only imagine that you use the SetUnitPrice methods. These will automatically set the OrderLine.Type to Fixed. Please note that AllowOverridePrices is not compatible with unit prices since AllowOverridePrices allows you to completely control the PriceInfo price of the OrderLine, that is the total price (including quantity) of the OrderLine.
Hope this clears up some confusion :)
- Jeppe
Setting AllowOverridePrices to true will not have any effect on the OrderLine.Type property. The only thing AllowOverridePrices does is: if set to true, you get the internal PriceInfo object back when accessing the Price property of the OrderLine.
If you experience that the Type of the OrderLine changes then I can only imagine that you use the SetUnitPrice methods. These will automatically set the OrderLine.Type to Fixed. Please note that AllowOverridePrices is not compatible with unit prices since AllowOverridePrices allows you to completely control the PriceInfo price of the OrderLine, that is the total price (including quantity) of the OrderLine.
Hope this clears up some confusion :)
- Jeppe
Jeppe Eriksson Agger
Posted on 14/02/2012 13:55:33
This post has been marked as an answer
PS. this question should have been placed in the Developer section :)
Votes for this answer: 1
Konstant van der Linden
Posted on 14/02/2012 14:11:17
Hi Jeppe,
My ERP returns prices and amounts for VAT and discounts.
I would like to put everything into one orderline.
I do this with my orderline:
and after that I add similar lines for line-discounts and at the end one for the order-discount.
Is there another way to achieve this?
Thx,
Konstant
My ERP returns prices and amounts for VAT and discounts.
I would like to put everything into one orderline.
I do this with my orderline:
x.AllowOverridePrices = true; x.Quantity = line.QuantitySpecified ? line.Quantity.ToDouble() : default(double); var vatPerc = line.VATpercentageSpecified ? line.VATpercentage.ToDouble() : default(double); x.SetUnitPrice(new PriceInfo { Currency = Context.Currency, PriceWithVAT = line.UnitPriceInclVATSpecified ? line.UnitPriceInclVAT.ToDouble() : default(double), PriceWithoutVAT = line.UnitPriceExclVATSpecified ? line.UnitPriceExclVAT.ToDouble() : default(double), VAT = line.UnitVATSpecified ? line.UnitVAT.ToDouble() : default(double), VATPercent = vatPerc }); x.Price.PriceWithVAT = line.LinePriceInclVATSpecified ? line.LinePriceInclVAT.ToDouble() : default(double); x.Price.PriceWithoutVAT = line.LinePriceExclVATSpecified ? line.LinePriceExclVAT.ToDouble() : default(double); x.Price.VAT = line.LineVATSpecified ? line.LineVAT.ToDouble() : 0D;
and after that I add similar lines for line-discounts and at the end one for the order-discount.
Is there another way to achieve this?
Thx,
Konstant
Jeppe Eriksson Agger
Posted on 14/02/2012 15:32:58
This post has been marked as an answer
Your call to SetUnitPrice is the one that changes your Type to Fixed. I don't see this as a problem for the product OrderLine but it could be for the Discount line. To fix this for the Discount do this after your call to SetUnitPrice:
x.Type = ((int)OrderLine.OrderLineType.Discount).ToString();
- Jeppe
Votes for this answer: 0
You must be logged in to post in the forum