I have a discount that gives you item x free when you buy item y
this works fine in the cart and checkout, but when you get to the review order it gives item y free instead of item x
if i hit the back button and review order again the discount is applied correctly. also if there is an error in the checkout form and the user has to resubmit, the discount applies correctly.
if i apply it as by item x, get a second item free the discount does not appear on the first visit to the review order page, but does if i go back and forward.
has anyone noticed this behaviour? any ideas what could be causing it, i am using discounts with flatrate and multicurrency so maybe they're not playing nice together, but if anyone has seen this also pls let me know.
thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | uc_discounts-2.4.patch | 716 bytes | willowmedia |
Comments
Comment #1
johnhanley commentedI can confirm this issue exists when using the "Qualification type" of "Minimum quantity". Specifically, the discount will only be applied on the "Review order" page after clicking "Back" (to the "Checkout" page) and "Review order" again. This behavior suggests the calculation is taking place after the "Review order" is rendered the first time or when returning to the "Checkout" page a second time.
As it stands this obviously makes the module practically worthless for "buy one get one free" type of discounts. I'm kind of surprised this issue hasn't been more widespread and problematic for other users.
Comment #2
johnhanley commentedDelving further into this issue, I have discovered the source of the problem.
There's an attribute in the product array of an order object called "uc_discounts_is_fully_discounted" that when set to TRUE prevents the free item discount calculation from occurring. If line 1649 uc_discount.module is commented out, the free item discount is correctly applied on the review page after submitting the checkout page the first time.
This is obviously NOT a solution. Instead, the logic associated with the previously referenced line needs to be reworked so the free item discount is calculated correctly after the first checkout submit.
Comment #3
willowmedia commentedI don't know whether this is a 'proper' fix or not, but it seems to work on my development site - basically I unset the uc_discounts_is_fully_discounted attribute before the function get_discounts_for_order does its work.
Comment #4
willowmedia commented