Hi there,
I have created two custom SalesDiscountProvider classes; one that pulls a discount value from a custom order line field (retrieved from an external system) - an order line discount - and one where a sales rep can enter a custom discount value for the entire order - an order discount.
When debugging, I noticed that the order the discount providers where called was wrong (I wanted the order discount to run after the order line discount so I could calculate a percentage of the entire order after line discounts) . I fiddled with the AddInOrder attribute but that didn't seem to make a difference. Renaming the providers in alphabetical order seemed to the trick.
However, once they were called in the correct order, I noticed that when running the second provider, I don't see the lines created by the first. Here's what I am seeing:
- MC settings are set to "Aggregated"
- Order has two lines
- Order line discount fires. Order has two lines. I add a new one and then it has three lines
- Order discount fires. I am back to two lines. I am adding a new one and then it has three lines
- The cart renders, and all discounts are applied correctly.
Is this expected behavior? Why am I not seeing the line created in step 2 when running the discount from step 3?
I worked around it by reapplying the same logic from the first provider in the second, but it feels quite wrong to do so ;-)
Any ideas?
Imar