I'm having an issue with uc_userpoints_discount & uc_taxes. After entering the amount of points to be applied as a discount on the Checkout page, the Review Order page shows the discount properly but shows taxes for the order amount before discount.

If I click "Back" and then click "Review Order" again, it calculates correctly. It also calculates correctly if some required information is missing from the Checkout form, forcing that form to reload before being able to get to the Review Order page.

I have seen similar problems in issue queues for other modules, but I'm not sure how to address it here.

Comments

handsofaten’s picture

From what I can tell, the culprit here is the sequence in which hook_order is called for uc_taxes and uc_discount. When uc_taxes_order ($op == 'save') is called, uc_discount_order ($op == 'save') has not yet been called. Thus, in uc_taxes_order ($op == 'save'), this line invokes uc_discount_order ($op == 'load) before uc_discount_order has saved the discount applied in the checkout form:

$line_items = $callback('load', $arg1);

This is why it calculates correctly when going back to checkout and then reviewing the order again -- uc_discount_order ($op == 'save') has updated the discount in the previous save call.

But, I have no idea how to change the sequence in which these implementations of hook_order are called.

Any help would be appreciated.

marinex’s picture

You can change module weight of the discount module in the system table so it should be lighter than uc_taxes module.