the current module for uc_taxes does not apply any actions that are found in the Conditional Actions module.

Following the chain from uc_taxes_calculate I don't see anywhere in the chain anything that will actually apply any of the actions that may be put into the Conditionals Action for taxation. This means that any custom actions to change the tax rate is not done in any way.

While I could and probably will make a module that will use the hook_calculate_tax call, I would have liked the ability to use the Conditional Actions to the fullest.

Is there a road map or ETA on this integration?

Comments

graper’s picture

I was able to get the custom actions to work properly with very little added code and I hope that these changes can be implemented even if I have not provided a patch file.

First is to change line 448 of uc_taxes module to this

$line_item = uc_taxes_action_apply_tax($order, $tax, $predicates['uc_taxes_'. $tax->id], $arguments);

this sends the predicate and the arguments from the conditions to be applied along with the order and tax objects

inside uc_taxes.ca.inc
Change the function to accept the 2 new arguments

function uc_taxes_action_apply_tax($order, $tax, $predicate =array(), $arguments=array()) {

and add one line to apply the custom actions

$results=ca_perform_actions($predicate, $arguments);

that's all that's needed to get the actions to be applied from the conditional actions module.

sorry about not providing a patch file, just not enough time to get the svn downloaded and diff it out.

granville

longwave’s picture

Status: Active » Closed (works as designed)

This is by design, only conditions make sense here really - running an action every time tax is calculated (or a shipping quote is retrieved, which uses the same code) doesn't make sense. If you need to alter something about the tax calculation itself, an alter hook would be more appropriate to add.