uc_discounts and uc_taxes

Posts: 32
Joined: 01/28/2008

I'm currently trying to diagnose an issue with uc_discounts and uc_taxes. I realize that uc_discounts is not actively being maintained, but am hoping to get a pointer in the right direction for where I might go to fix up the code for this particular issue.

I am using the version of uc_discounts posted on 01/07/08, which adds support for hook_line_item.

Here's the scenario:

I have some class-based discounts applied to the purchase of a product. The first time I go to the checkout page, and enter all the required information, the calculation for sales tax is correct.

When I submit to "review order", the tax calculation is incorrect, calculating on the Subtotal before the tax item is applied. This incorrect tax is also reflected in the uc_order_line_items table.

If I click 'Back', the data on the checkout page is correct, but the entry in uc_order_line_items is still wrong. When I click "review order" again, the information presented is now correct, and the uc_order_line_items table has the proper tax line in it.

So, I'm thinking there has to be some hook in uc_discounts that's not being triggered prior to uc_taxes being calculated the first time. The troublesome issue here is obviously that it is calculated correctly after the second submission to the "review order" page.

Is this a weighting issue? The data for the discount is in the uc_order_line_items table in all stages of the process, as a negative value, which is to be expected, but it seems that the first time the order is created, tax is being calculated prior to applying the discount.

Which hook/weight/etc. do I need to study to figure out how to fix this?

Thanks in advance...

Posts: 32
Joined: 01/28/2008

For anyone interested, I solved this by ensuring that the code executed during 'save' also happens during the 'new' op. This seemed to solve the issue when moving from the checkout stage to the review stage, and all is happy and well.

Posts: 2
Joined: 08/12/2008

Could you please let us know more details about your solution? I have the same problem but nothing worked so far.
Thanks a lot!

Posts: 9
Joined: 08/12/2007

I'm interested as well.
As I see, the current uc_discounts.module does not do anything at checkout_pane $op 'process'.
I tried modifying the module's hook_order() to do the same at $op 'new' like at 'save' but still no luck, the taxes get calculated before the discount line items get saved into {uc_order_line_items}