Sorry for the quadruple post, but I think I have solved the above issues, and possibly fixed some bugs along the way. The sub total was updating, it was just me not noticing. There was a problem with the VAT calculation though, it didn't seem to be including the onetime charge VAT. This was due to a stray semi-colon, took me a while to notice that one!
In edit_orders_functions.php around line 818 in eo_get_product_taxes()
Code:
$taxAdd = zen_calculate_tax($product['final_price'], $product['tax']) * $product['qty'];
+ zen_round(zen_calculate_tax($product['onetime_charges'], $product['tax']), $decimals);
has an extra ; on the first line, and should instead be
Code:
$taxAdd = zen_calculate_tax($product['final_price'], $product['tax']) * $product['qty']
+ zen_round(zen_calculate_tax($product['onetime_charges'], $product['tax']), $decimals);
I then found that there was a problem with the subtotal not being calculated correctly when adding and removing a onetime charge. This may have been a known issue, I think I have fixed it, but wanted to see if anyone knows what knock on effects this might have.
Also in edit_orders_functions.php around line 747 in eo_update_order_subtotal()
I have wrapped the $shown_price calculation in a check for whether prices are displayed with tax, and removed the tax calculation accordingly so it is now:
Code:
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$shown_price = zen_round(zen_add_tax($product['final_price'], $product['tax']), $decimals) * $product['qty'];
$shown_price += zen_round(zen_add_tax($product['onetime_charges'], $product['tax']), $decimals);
} else {
$shown_price = zen_round($product['final_price'], $decimals) * $product['qty'];
$shown_price += zen_round($product['onetime_charges'], $decimals);
}
The next problem that I have found is that I seem to be able to add lines of order total amounts with any name and value, but these do not get added onto the order total, and then get removed upon update. Is this what this point in the readme is referring to?
- Add option to disable automatic order total calculations. This would allow the use of lines which do not have a corresponding order_total.
Cheers
Bookmarks