Hi folks,
I have the following scenerio I need to get working with DW and I'm struggling:
Ecom product is of type ProductType.BOM
The price needs to be calculated as following:
Ecom product price * User defined quantity + sum of (bomitem user defined quantity * bomitem price)
The subtotal of "bomitem user defined quantity * bomitem price" can never get below "predefined quantity * bomitem price"
For example:
Package A has a Fixed price of EUR 100 and has 2 bom items
- 1 x Bom A, UnitPrice EUR 25
- 2 x Bom B, UnitPrice EUR 50
The product tile will show EUR 100 (that is ok)
The product page will show EUR 100 (that is ok, i show the additional costs with javascript)
The user plusses "Bom B" from quantity 2 to 4 (the additional costs are changed by javascript)
The user plusses "Package 1" from quantity 1 to 10
The user adds this to the cart (I change the selected bom quantity in the EcomCartLineAddedObserver)
The cart shows:
10 x Package A, UnitPrice EUR 100, Subtotal EUR 1.000
- 1 x Bom A
- 4 x Bom B
----------------------------------------------------
Total: EUR 1.000
I ONLY want to do custom calculation on the Subtotal mentioned above, I need it to be set to EUR 1.225 (10 x 100 + (1x25) + (4x50)) and then update the tot price accordingly. I need a PLACE to calculate and replace the orderline price to custom business rules.
What is the proper way to accomplish this?
I've been tinkering with PriceProvider, EcomCartLineAddedObserver, PreparedPrices, etc. but can't get the Orderline.Price.Price to not be recalculated to EUR 1.000
Thanks in advance,
Peter.