After creating a custom SalesDiscountProvider I noticed that orderlines with ParentLineID does not affect the sorting of orderlines when rendered.
I would expect all orderlines with a parent id to follow that parent orderline, so that they are rendered in correct order.
Example:
- OrderLine (ID="OL1", ParentLineID="")
- OrderLine (ID="OL2", ParentLineID="")
- OrderLine (ID="OL4", ParentLineID="OL2")
- OrderLine (ID="OL5", ParentLineID="OL2")
- OrderLine (ID="OL3", ParentLineID="")
I was able to "fix" this by implementing custom sort functionality in an OrderTemplateExtender, but I think this should be handled automatically by eCommerce when ParentLineID is set.
DW version: 8.4.1.19
Sample code from custom SalesDiscountProvider:
var discountPrice = this.CalculateDiscountPrice(orderLine, this.DiscountValue.Amount); var discountOrderLine = this.CreateOrderLine(order, orderLine, discountPrice); order.OrderLines.Add(discountOrderLine, false); private OrderLine CreateOrderLine(Order order, OrderLine parent, double discountPrice) { var orderLine = new OrderLine(); orderLine.OrderID = order.ID; orderLine.Order = order; orderLine.Quantity = 1.0; orderLine.Modified = DateTime.Now; orderLine.ProductName = this.DiscountName; orderLine.SetUnitPrice(discountPrice); orderLine.DiscountID = this.DiscountID; orderLine.ParentLineID = parent.ID; orderLine.Type = Base.ChkString(Base.ChkNumber(OrderLine.OrderLineType.ProductDiscount)); return orderLine; }