Hi there,
I have created a "Product Discount" that gives a 4 euro discount on products of a specific group. I need to subtract this discount from the product price when I submit an order into a backend system.
When I order one of those products and look at the cart, I see two OrderLine instances: one for the product, and one for the discount.
When I look at the product line, the OrderLineDiscountID is empty. When I look at the discount line, the OrderLineProductID is empty.
How can I determine the product in the order that the product discount applies to?
Imar
Developer forum
E-mail notifications
Association between order line for a product and a discount
Posted on 19/11/2010 15:42:49
Replies
Nicolai Høeg Pedersen
Posted on 19/11/2010 15:48:30
Since more than one discount can be valid for an orderline, you find the discount on a specific product using OrderLine.Prouct.Discounts.
Posted on 19/11/2010 15:51:36
Ah, I see.
Where is that modelled in the database? For the export module I am using Entity Framework so I more or less recreated the Ecom api....
Imar
Where is that modelled in the database? For the export module I am using Entity Framework so I more or less recreated the Ecom api....
Imar
Nicolai Høeg Pedersen
Posted on 19/11/2010 15:59:58
Well - it is the extensibility that handles the discounts. So it is not in the database but a "real time" calculation of which discounts are applicable for the product right in that moment.
The persistence to the database is in the orderline table only.
The persistence to the database is in the orderline table only.
Posted on 19/11/2010 16:19:02
Before your message edit, you mentioned the OrderLineParentID, but that once seems to be empty. is that why you removed it?
So, the only thing I have as an option is to reproduce discount calculation based on the XML in the SalesDiscountParameters column?
Or is there another option? Maybe hook into some extensibility event? Maybe I could recreate the Product Discount provider and "tag" each product with a product specific discount price?
Heavy stuff for a Friday afternoon.... ;-)
Imar
So, the only thing I have as an option is to reproduce discount calculation based on the XML in the SalesDiscountParameters column?
Or is there another option? Maybe hook into some extensibility event? Maybe I could recreate the Product Discount provider and "tag" each product with a product specific discount price?
Heavy stuff for a Friday afternoon.... ;-)
Imar
Nicolai Høeg Pedersen
Posted on 19/11/2010 16:47:36
OrderLineParentID is BOM products.
OrderLine.type defines if its a product or not.
But you can create either a orderline discount or an order discount.
Orderline discounts uses the CreateProductOrderline in the FindPricde method which links the discount to a product.
Order discounts uses the CreateAmountOrderline which is a discount on the order, and that is not linked to the original product...
Makes sense?
OrderLine.type defines if its a product or not.
But you can create either a orderline discount or an order discount.
Orderline discounts uses the CreateProductOrderline in the FindPricde method which links the discount to a product.
Order discounts uses the CreateAmountOrderline which is a discount on the order, and that is not linked to the original product...
Makes sense?
Posted on 19/11/2010 17:02:16
>> Makes sense?
Not quite. Is this a suggestion for a custom discount provider? Or can I do this from my order push tool? It doesn't run in a DW / user scope but from a command line.....
Imar
Not quite. Is this a suggestion for a custom discount provider? Or can I do this from my order push tool? It doesn't run in a DW / user scope but from a command line.....
Imar
Nicolai Høeg Pedersen
Posted on 19/11/2010 17:19:54
Are you using a custom discount or a build in? And if using a build in, which one?
Otherwise provide the content of findprice.
Otherwise provide the content of findprice.
Posted on 19/11/2010 18:05:17
I am using the built-in Product discount (first available discount). I assign a few groups and a discount value (either a percentage or a fixed amount)....
Imar
Imar
You must be logged in to post in the forum