function before_process() { $script_path = $_SERVER['HTTP_REFERER']; $me = explode('main_page=', $script_path); $result = explode('&', $me[0]); if ($result[0] == 'checkout_confirmation') { zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } if (isset($_SESSION['mb_cs_order_id'])) { global $order; //Afterbuy handle if (AFTERBUY_ACTIVATED == 'true') { require_once DIR_WS_CLASSES . 'afterbuy.php'; $aBUY = new zen_afterbuy($_SESSION['mb_cs_order_id']); if ($aBUY->order_send()) { $aBUY->process_order(); } } //end afterbuy handle //assign the products details of the order $order->products_ordered_html = $_SESSION['products_details_for_email']; $order->send_order_email($_SESSION['mb_cs_order_id'], 2); unset($_SESSION['products_details_for_email']); unset($_SESSION['mb_cs_order_id']); } $_SESSION['cart']->reset(true); unset($_SESSION['sendto']); unset($_SESSION['billto']); unset($_SESSION['shipping']); unset($_SESSION['payment']); unset($_SESSION['comments']); unset($_SESSION['cot_gv']); zen_redirect(zen_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); return false; }
$payment_modules->before_process(); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_BEFOREPROCESS'); // create the order record $insert_id = $order->create($order_totals, 2); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE'); $payment_modules->after_order_create($insert_id); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE'); // store the product info to the order $order->create_add_products($insert_id); $_SESSION['order_number_created'] = $insert_id; $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS'); //Afterbuy handle if (AFTERBUY_ACTIVATED == 'true') { require_once DIR_WS_CLASSES . 'afterbuy.php'; $aBUY = new zen_afterbuy($insert_id); if ($aBUY->order_send()) { $aBUY->process_order(); } } //end afterbuy handle //send email notifications $order->send_order_email($insert_id, 2); $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'); /** * Calculate order amount for display purposes on checkout-success page as well as adword campaigns etc * Takes the product subtotal and subtracts all credits from it */ $credits_applied = 0; for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { if ($order_totals[$i]['code'] == 'ot_subtotal') { $order_subtotal = $order_totals[$i]['value'];