
Originally Posted by
toholio
I've been setting up Super Orders and have run into a problem with order totals editing. From this thread I can see that the problem is quite common.
In Australia, and other countries, prices need to always be shown including tax. This means that invoices include the total of all item prices (inc. tax) in addition to a tax field.
So an invoice might have the following:
Order subtotal: $45
Included Tax: $4.09
Total: $45
If one edits the order totals using Super Orders then the new total will have the tax summary incorrectly added to the tax inclusive subtotal. Using the above totals as an example, if one opens the edit totals window and clicks submit without actually changing anything then the totals would be changed to:
Order subtotal: $45
Included Tax: $4.09
Total: $49.09
The quick and dirty fix I'm using for this problem is to comment out line 491 in super_edit.php which will remove tax from the running total calculated there.
Obviously a better solution would be required for people who do sometimes need tax added. The addition of tax in the total could be made conditional but I'm unsure of what to test...
Hope this helps.
Ah. Those Americans. Never before has the world seen a nation with the ability to create such complex sales taxes. I have a client whose state levies sales taxes at the state, county and city levels creating literally thousands of possible rates. If they'd known, maybe they would have been more sympathetic to the British tea tax! Happily (and amazingly) Zen Cart copes.
However, over here in the UK, as in many other countries, consumer products are priced inclusive of sales tax and if the tax is mentioned at all, it's simply as a memo item on a receipt. For most of my clients therefore I swap the tax and total fields around to read
Unit price inc VAT: £22.50
Quantity: 2
Order subtotal: £45.00
Shipping: £5.00
Total: £50.00
Included VAT: £8.75
As Toholio has observed, Super Orders really doesn't like this, and I'm surprised that there's not been more discussion on this. Maybe because it only becomes obvious when you split or edit an order?
However, persuading it to work our way isn't so difficult. Here's the approach that I've just implemented for a client ...
Find the admin\includes\functions\extra_functions\super_orders_functions.php file and within it the recalc_total() function.
Find this block near the top
PHP Code:
// not everyone charges tax, so we check to see if it exists first
if ($products->fields['products_tax'] > 0) {
$this_tax = $this_subtotal * ($products->fields['products_tax'] / 100);
$ot_tax += $this_tax;
}
and replace it with
PHP Code:
// not everyone charges tax, so we check to see if it exists first
if ($products->fields['products_tax'] > 0) {
$this_tax = $this_subtotal * ($products->fields['products_tax'] / 100);
$ot_tax += $this_tax;
$ot_subtotal += $this_tax; // add tax for products quoted inclusive of tax
}
This creates a subtotal that is inclusive of tax
Find this block
PHP Code:
if ($all_totals->fields['class'] != 'ot_total') {
if ($all_totals->fields['class'] == 'ot_gv' || $all_totals->fields['class'] == 'ot_group_pricing') {
$ot_total -= $all_totals->fields['value'];
}
else {
$ot_total += $all_totals->fields['value'];
}
}
and replace it with
PHP Code:
if ($all_totals->fields['class'] != 'ot_total' && $all_totals->fields['class'] != 'ot_tax') {
if ($all_totals->fields['class'] == 'ot_gv' || $all_totals->fields['class'] == 'ot_group_pricing') {
$ot_total -= $all_totals->fields['value'];
}
else {
$ot_total += $all_totals->fields['value'];
}
}
This prevents the tax from being adding into the overall total (which would be a double count).
This probably won't work for everybody, but will hopefully show how easy it is to tweak Super Orders to cope with different tax regimes and customs.
Bookmarks