Ok, I fixed this, for my setup anyway. (We add tax and display with tax, and credit including tax is true for Gift Certificates)
In zen cart 1.3.6 \includes\modules\order_total\ot_gv.php
function update_credit_account is changed thus:
PHP Code:
function update_credit_account($i) {
global $db, $order, $insert_id;
if (ereg('^GIFT', addslashes($order->products[$i]['model']))) {
$gv_order_amount = ($order->products[$i]['final_price'] * $order->products[$i]['qty']);
// bikemike: round helps us keep to multiples of gv face value :-) as per ot_coupon
// if ($this->credit_tax=='true') $gv_order_amount = $gv_order_amount * (100 + $order->products[$i]['tax']) / 100;
if ($this->credit_tax=='true') $gv_order_amount = round($gv_order_amount * (100 + $order->products[$i]['tax']) / 100,2);
// bikemike: end
$gv_order_amount = $gv_order_amount * 100 / 100;
if (MODULE_ORDER_TOTAL_GV_QUEUE == 'false') {
// GV_QUEUE is false so release amount to account immediately
$gv_result = $this->user_has_gv_account($_SESSION['customer_id']);
$customer_gv = false;
$total_gv_amount = 0;
if ($gv_result) {
$total_gv_amount = $gv_result;
$customer_gv = true;
}
$total_gv_amount = $total_gv_amount + $gv_order_amount;
if ($customer_gv) {
$db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . (int)$_SESSION['customer_id'] . "'");
} else {
$db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . (int)$_SESSION['customer_id'] . "', '" . $total_gv_amount . "')");
}
} else {
// GV_QUEUE is true - so queue the gv for release by store owner
$db->Execute("insert into " . TABLE_COUPON_GV_QUEUE . " (customer_id, order_id, amount, date_created, ipaddr) values ('" . (int)$_SESSION['customer_id'] . "', '" . (int)$insert_id . "', '" . $gv_order_amount . "', NOW(), '" . $_SERVER['REMOTE_ADDR'] . "')");
}
}
}
I hope this helps someone, as I went through an upgrade to find it was still not working :-(
cheers
Bookmarks