well, at least I've isolated the section of code that fixes the bug.
find this section of code:```
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;
and replace with
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;
And it now calculates correctly when coupons are applied to multiple product purchases. You are right that it appears it was fixed in a previous version - why it came back with 1.3.6 (7?) i'm not sure.
- Steven