silvershop / silvershop-discounts

Adds Discount and Coupon support for SilverShop
Other
9 stars 38 forks source link

Multiple cart-level discounts results in discount greater than total #21

Closed jedateach closed 10 years ago

jedateach commented 10 years ago

When the discount is greater than the total, you get negative order totals.

If you have two+ cart total discounts they may both be applied to the subtotal, and therefore add up to greater than the subtotal. This is a motivation to switch to cart-level discounts actually applying to individual items. Or another approach is to apply cart level discounts to whatever is left after item discounts have been applied?

See Calculator.php https://github.com/burnbright/silverstripe-shop-discount/blob/master/code/Calculator.php#L31

If orders get through with this bug, then it may turn out that discounts are counted because they are linked to the order, yet the total discounted amount will still be greater than the order value.

jedateach commented 10 years ago

I've built in a few restrictions to prevent negative sales, but still need to solve the issue at hand.

jedateach commented 10 years ago

I have restructured the way that discounts are applied to an order:

jedateach commented 10 years ago

@chillu any chance that you or one of the team could peer review this fix at some stage? c2f97add80c164e2690340d328ff4c48169caa10