Administrator
- Join Date:
- Feb 2006
- Location:
- Tampa Bay, Florida
- Posts:
- 10,746
- Plugin Contributions:
- 56
[Done 1.3.6] Group discount tax calculation error
l. 71 is
$od_amount[$key] = $tod_amount = round((($od_amount['total'] * $tax_rate)) /100, 2) ;
I believe this is incorrect, since od_amount['total'] would include shipping and or tax if
these respective settings are true. Rather, I believe the following algorithm should be used:
above the switch statement (l.65)
$od_amount['taxable'] = $od_amount['total'];
if ($this->include_shipping == 'true')
$od_amount['taxable'] -= $order->info['shipping_cost'];
if ($this->include_tax == 'true')
$od_amount['taxable'] -= $order->info['tax'];
then l. 71 becomes
$od_amount[$key] = $tod_amount = round((($od_amount['taxable'] * $tax_rate)) /100, 2) ;
Test case: create a discounting group that gives 100% off. Install group discount with default settings, then set include tax = false, include shipping = true. Check out, and you will see the total is less than 0. With this fix, it is zero (and you can permute the include tax and include shipping settings and see that the total is also correct, with the caveat that stores that use include_tax = true should use re-calculate tax = none.
Scott
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.