Hi. I am working on a project where I need for the customer to be able to specify the price he/she is prepared to pay per LineItem where the catalog price is used as a lower limit. This is to be done only for select products. The discounts and promotion engine are then to be applied, making it possible for the customer to enter an amount that is then lowered by a discount (e.g. a percentage). How can I do this when the IPromotionEngine, IPlacedPriceProcessor etc all calculate their prices based on the price of the catalog. In the promotion engine etc there are no way of knowing which LineItem the price is calculated for and thus no way of obtaining the price from the LineItem instead of from the catalog.How can I do this? Can I still use the promotion engine or do I need to perform the discounts entirely custom? What is your recommendation?
I'm not seeing the big picture here, but why don't you apply every discount first, then allow the customer to set the price based on that value? Then you can set the PlacedPrice to the LineItem if the price set is valid.
I need the discounts to be applied to the price placed by the customer.
That might be exactly what the DefaultLineItemCalculator is for...
Nope. DefaultLineItemCalculator just aggregates the calculated values from what I can see.The problem with having the discount being calculated by the promotion engine etc is that the calculations, discount limits and percentages are calculated based on the catalog price.
A custom promotion engine seems an option in your case.
Are you certain the promotion engine is calculating based on the catalog price?
I was under the impression the cart is updated with the catalog price in a seperate step in the workflow prior to the discount calculations.
I would save the entered price to a custom meta field on the lineitem and attempt to write my own IPlacedPriceProcessor, the processor would then validate the custom meta price is larger than the catalog price and in that case set the PlacedPrice to the custom meta one.
I'm also missing the big picture a bit, but maybe you can use the solution Maris blogged about for adding a manual discount?
How do I best go about feeding a custom price into the discount/promotion calculation?
It has to be set as the PlacedPrice on the ILineItem.