예제 #1
0
 function osC_Checkout_Process()
 {
     global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment;
     if ($osC_ShoppingCart->hasContents() === false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'));
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
     }
     if ($osC_ShoppingCart->hasBillingMethod()) {
         // load selected payment module
         include 'includes/classes/payment.php';
         $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id'));
     }
     include 'includes/classes/order.php';
     if ($osC_ShoppingCart->hasBillingMethod()) {
         $osC_Payment->process();
     } else {
         $orders_id = osC_Order::insert();
         osC_Order::process($orders_id, ORDERS_STATUS_PAID);
     }
     $osC_ShoppingCart->reset(true);
     // unregister session variables used during checkout
     unset($_SESSION['comments']);
     osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL'));
 }
예제 #2
0
 function osC_Checkout_Process()
 {
     global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment;
     if ($osC_Customer->isLoggedOn() === false) {
         $osC_NavigationHistory->setSnapshot();
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     }
     if ($osC_ShoppingCart->hasContents() === false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'));
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL'));
     }
     // load selected payment module
     include 'includes/classes/payment.php';
     $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id'));
     if ($osC_Payment->hasActive() && $osC_ShoppingCart->hasBillingMethod() === false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
     include 'includes/classes/order.php';
     $osC_Payment->process();
     $osC_ShoppingCart->reset(true);
     // unregister session variables used during checkout
     unset($_SESSION['comments']);
     osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL'));
 }
예제 #3
0
 function saveOrder()
 {
     global $toC_Json, $osC_Language, $osC_Payment, $osC_ShoppingCart;
     // load selected payment module
     require_once 'includes/classes/payment.php';
     $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id'));
     if ($osC_Payment->hasActive() && $osC_ShoppingCart->hasBillingMethod() === false) {
         osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
     require_once 'includes/classes/order.php';
     $osC_Payment->process();
     $response = array('success' => true);
     echo $toC_Json->encode($response);
 }