---------------------------------------------------------------------------------
-- [Version] 0.0.1.alpha [/Version]
-- CCGV 5.19 Fix for GV Queue with Paypal IPN
-- mailto:code@creativeportal.ca
--
CreativePortal.ca - A Host of New Ideas written by Chris Bensler
---------------------------------------------------------------------------------
Fixes an issue when a customer buys a gift voucher and pays with paypal, the order_id stored in the coupon_gv_queue table is always 0.
The problem is that the order id that is being stored is referencing a global, but the call is nested in the paypal payment class
so $insert_id is not in the global scope.
The fix is to update all definitions of the update_credit_acount method to accept a second $order_id param.
All calls to update_credit_account($i) should also be replaced with update_credit_acount($i,$insert_id).
---------------------------------------------------------------------------------
MOD INSTRUCTIONS:
---------------------------------------------------------
in includes/modules/order_total/ot_gv.php
---------------------------------------------------------
Replace:
function update_credit_account($i) {
global $order, $customer_id, $insert_id, $REMOTE_ADDR;
With:
function update_credit_account($i, $order_id=0) {
global $order, $customer_id, $insert_id, $REMOTE_ADDR;
if (!$order_id) $order_id = $insert_id;
---------------------------------------------------------
Replace $insert_id with $order_id in:
$gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_QUEUE . " (customer_id, order_id, amount, date_created, ipaddr) values ('" . $customer_id . "', '" . $insert_id . "', '" . $gv_order_amount . "', NOW(), '" . $REMOTE_ADDR . "')");
---------------------------------------------------------
in includes/modules/order_total/ot_coupon.php
---------------------------------------------------------
Replace:
function update_credit_account($i) {
With:
function update_credit_account($i, $order_id=0) {
---------------------------------------------------------
in includes/classes/order_total.php
---------------------------------------------------------
Replace:
function update_credit_account($i) {
With:
function update_credit_account($i, $order_id=0) {
---------------------------------------------------------
Replace:
$GLOBALS[$class]->update_credit_account($i);
With:
$GLOBALS[$class]->update_credit_account($i, $order_id);
---------------------------------------------------------
in checkout_process.php
**NOTE** this mod is not needed but for conformity
---------------------------------------------------------
Replace:
$order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
With:
$order_total_modules->update_credit_account($i,$insert_id);//ICW ADDED FOR CREDIT CLASS SYSTEM
---------------------------------------------------------
in includes/modules/payment/gv_paypal_ipn.php
**NOTE** if you use another paypal ipn module, you must apply this fix similarly
---------------------------------------------------------
Replace:
$order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
With:
$order_total_modules->update_credit_account($i,$insert_id);//ICW ADDED FOR CREDIT CLASS SYSTEM
Bookmarks