Example #1
0
require BITCOMMERCE_PKG_PATH . 'classes/CommercePaymentManager.php';
$paymentManager = new CommercePaymentManager($_SESSION['payment']);
// load the selected shipping module
require BITCOMMERCE_PKG_PATH . 'classes/CommerceShipping.php';
$shipping_modules = new CommerceShipping($_SESSION['shipping']);
require BITCOMMERCE_PKG_PATH . 'classes/CommerceOrder.php';
$order = new order();
require DIR_FS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_totals = $order_total_modules->process($_REQUEST);
$gBitDb->mDb->StartTrans();
// load the before_process function from the payment modules
if ($order->hasPaymentDue() && !$paymentManager->processPayment($_REQUEST, $order)) {
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, NULL, 'SSL', true, false));
}
$newOrderId = $order->create($order_totals, 2);
$order->create_add_products($newOrderId);
$paymentManager->after_order_create($newOrderId);
$order->send_order_email($newOrderId);
$gBitDb->mDb->completeTrans();
$paymentManager->after_process();
$gBitCustomer->mCart->reset(true);
// unregister session variables used during checkout
foreach (array('sendto', 'billto', 'shipping', 'payment', 'comments') as $key) {
    if (isset($_SESSION[$key])) {
        unset($_SESSION[$key]);
    }
}
$order_total_modules->clear_posts();
//ICW ADDED FOR CREDIT CLASS SYSTEM
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));