Hello at all,
I'd like to integrate uc_vat 6.x-1.2 with uc_vat_with_taxonomy. I found this module here: http://www.ubercart.org/issue/15097/conditionally_tax_products_based_tax... .
So I contacted the author who gave me this advice:
Yes, I created uc_taxonomy_tax and uc_vat_with_taxonomy. I didn't end up using uc_vat_with_taxonomy as it wasn't needed for the project, but I think it was working.
The uc_vat_with_taxonomy works by adding in an extra table to store the taxonomy terms and tax rates. That's probably why the .install file is different (the .install just sets up all the tables).
However, I would probably get the latest copy of uc_vat, and try to apply the changes I made to that, because uc_vat_with_taxonomy was based on an old version of uc_vat.
Infact, the best thing to do would be to create a patch, that you could then re-apply everytime uc_vat gets updated.
So the changes in the .module file are fairly simple. Whenever the tax is calculated it goes through a check of in_array($type, $tax->taxed_product_types)
So I simply searched for every instance of this line of code, and added in uc_vat_check_taxonomy_terms($nid, $tax->id) as well. So it became
if (in_array($type, $tax->taxed_product_types) || uc_vat_check_taxonomy_terms($nid, $tax->id)) {
I think that's all there was too it. But as I said I did not end up using it so can't confirm it was working 100%.
Hope that helps
Leon
and:
I would try to merge the .install file from uc_vat_with_taxonomy with the new uc_vat install (it could well have changed since the module).
If the uc_vat install file already has a schema, all you need to do is copy over is the array for uc_taxonomy_tax table inside of the schema.
If not, copy over the entire schema function, and make sure you install/uninstall the schema on hook_install and hook_uninstall
Have a look at http://drupal.org/developing/api/schema for more info on the Drupal schema system.
Thanks
Leon
So I'd like to test this. But first of all: Could anyone explain me the following two functions?
function uc_vat_update_6000() {
$ret = array();
$value = variable_get('uc_vat_edit_inclusive', FALSE);
variable_set('uc_vat_list_price_inclusive', $value);
variable_set('uc_vat_cost_inclusive', $value);
variable_set('uc_vat_sell_price_inclusive', $value);
variable_del('uc_vat_edit_inclusive');
$ret[] = array('success' => TRUE, 'query' => 'Split "enter prices inclusive of VAT" option into separate options per price field.');
return $ret;
}
function uc_vat_update_6001() {
$ret = array();
if (variable_get('uc_pane_cart_vat_enabled', FALSE)) {
variable_set('uc_pane_cart_enabled', TRUE);
}
variable_del('uc_pane_cart_vat_enabled');
$ret[] = array('success' => TRUE, 'query' => 'Remove separate VAT-enabled checkout pane.');
return $ret;
}
And please do not refer to the comments. A short explanation what the comments mean would be great!
THX in advance.
maen