This thread is 1.5 years old, but I had this problem tonight, so I'll recap the fix for anyone else just arriving at this issue.
I'm using 1.3.7. The tax was not calculating correctly when I used a discount promo code coupon AND had 2 or more products. Apparently, a lot of people had the same problem. I'll post the code below that I grabbed from earlier in this thread, with a couple of clarifying notes.
NOTE: I've only bug-tested this fix for 10 minutes, and so far so good, but I'm not 100% sure of any other side effects this may cause. And it fixes the problem for me as stated above, but according to previous posts in this thread it may not cure all situations, e.g., if you are using group pricing (although I tried it w/ my group pricing and so far so good).
The file in question is: includes/modules/order_total/ot_coupon.php
There are 2 sections of identical code that needs to be replaced (one for Fixed coupons and one for Percentage coupons). So, replace the 2 instances of:
case 'Standard':
$ratio = $od_amount['total']/$this->get_order_total();
$products = $_SESSION['cart']->get_products();
for ($j=0; $j<sizeof($products); $j++) {
$t_prid = zen_get_prid($products[$j]['id']);
$cc_result = $db->Execute("select products_tax_class_id
from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
if ($is_valid_results) {
$tax_rate = zen_get_tax_rate($cc_result->fields['products_tax_class_id'], $tax_address['country_id'], $tax_address['zone_id']);
$tax_desc = zen_get_tax_description($cc_result->fields['products_tax_class_id'], $tax_address['country_id'], $tax_address['zone_id']);
if ($tax_rate > 0) {
// $od_amount[$tax_desc] += (($products[$j]['final_price'] * $products[$j]['quantity']) * $tax_rate)/100 * $ratio;
$od_amount[$tax_desc] += round(((($products[$j]['final_price'] * $products[$j]['quantity']) * $tax_rate) + .5)/100 * $ratio, 2);
$od_amount['tax'] += $od_amount[$tax_desc];
}
}
}
break;
```with:
```php
case 'Standard':
$ratio = $od_amount['total']/$this->get_order_total();
$t_prid = zen_get_prid($products[$i]['id']);
$cc_result = $db->Execute("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
$tax_rate = zen_get_tax_rate($cc_result->fields['products_tax_class_id'], $tax_address['country_id'], $tax_address['zone_id']);
$tax_desc = zen_get_tax_description($cc_result->fields['products_tax_class_id'], $tax_address['country_id'], $tax_address['zone_id']);
if ($tax_rate > 0) {
$od_amount[$tax_desc] += round(((($products[$i]['final_price'] * $products[$i]['quantity']) * $tax_rate) + .5)/100 * $ratio, 2); // JTD:08/30/05 - Tax Calc bug fix
$od_amount['tax'] += $od_amount[$tax_desc];
}
break;