First case
I have made two discounts:
- 10 % down for all products | qualification: zero minimum price | checked to be combined with other discounts | Weight "-50" - works fine alone
- 1 free item for one selected term of products (A) | qualification: 5 products | checked to be combined with other discounts | Weight "50" - works fine alone
When i put them together, they still work fine, but the all products discount still countign from the full price.
An example:
I have ordered 5 peace of product A each cost 100 - > price with free item discount is 400.
But the final price should be 360, because of the 10% discount on all products.
Instead of this the final price is 350, because the discount is computed from the price of products before the 1 free item discount.
And one more problem:
I tried to made the 10% discount not able to combine with other discounts.
I put in the cart 5 products (A) with some other products. I supposed, that discount will be counted separatedly - for (A) i should got discount 400, and for the other product i should got 10 % discount. But I did got only the first.
Comments
Comment #1
ryangroe commentedSorry for the delay, I hadn't signed up for issue notification so I am just seeing this today.
I think you are right in how it should work. The subtotal used by the discounts module isn't being updated between calculations. I have updated the code, and I tested it with your exact example.
Unfortunately my quick fix will still have problems if you apply the discounts in the opposite order (10% off first then buy 4 get one free) because the module does not keep track of the quantity discount each time it attempts to apply a discount. For example if you have 100 items in your basket and you discount them 10%, the remaining quantity that can be discounted should be 90 not 100. So I'll leave this issue open until I resolve that part as well.
The second part ("And one more problem") is more of a conceptual difference. I intended the "can be combined" flag to mean that if unchecked the discount could not be combined with any other discounts regardless of if the two discounts were applied to different items. So the functionality you saw was as expected. Though since I think you were only trying the "can be combined" flag as a workaround for your initial problem, I think we can leave the current "can be combined" flag functionality as-is.
The code has been committed in CVS and this will be available in beta 3 to be released tonight.
Some quick notes:
"buy 4 get 1 free weight 0", "10% off weight 1":
beta 2:
subtotal: $750, 150 items
buy 4 get 1 free: $150
10% off: $75 (wrong)
after fix:
subtotal: $750, 150 items
buy 4 get 1 free: $150
10% off: $60 (right)
"10% off weight 0", "buy 4 get 1 free weight 1":
beta 2:
subtotal: $750, 150 items
10% off: $75
buy 4 get 1 free: $150 (wrong)
after fix (does not fix this case):
subtotal: $750, 150 items
10% off: $75
buy 4 get 1 free: $150 (still wrong)
Comment #2
ryangroe commentedComment #3
ryangroe commentedComment #4
ezra-g commentedThis has been committed, so I'm marking it as fixed ;).