function osC_Checkout_Confirmation() { global $osC_Session, $osC_Services, $osC_Language, $osC_ShoppingCart, $osC_Customer, $osC_MessageStack, $osC_NavigationHistory, $osC_Breadcrumb, $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->hasShippingAddress() == false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } include 'includes/classes/order.php'; $this->_page_title = $osC_Language->get('confirmation_heading'); $osC_Language->load('order'); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Language->get('breadcrumb_checkout_confirmation'), osc_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL')); } if (isset($_POST['comments']) && isset($_SESSION['comments']) && empty($_POST['comments'])) { unset($_SESSION['comments']); } elseif (!empty($_POST['comments'])) { $_SESSION['comments'] = osc_sanitize_string($_POST['comments']); } if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1') { if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') { $osC_MessageStack->add('checkout_payment', $osC_Language->get('error_conditions_not_accepted'), 'error'); } } // load the selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment(isset($_POST['payment_method']) ? $_POST['payment_method'] : $osC_ShoppingCart->getBillingMethod('id')); if (isset($_POST['payment_method'])) { $osC_ShoppingCart->setBillingMethod(array('id' => $_POST['payment_method'], 'title' => $GLOBALS['osC_Payment_' . $_POST['payment_method']]->getMethodTitle())); } if ($osC_Payment->hasActive() && (isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) === false || isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && is_object($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && $GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]->isEnabled() === false)) { $osC_MessageStack->add('checkout_payment', $osC_Language->get('error_no_payment_module_selected'), 'error'); } if ($osC_MessageStack->size('checkout_payment') > 0) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL')); } if ($osC_Payment->hasActive()) { $osC_Payment->pre_confirmation_check(); } // Stock Check if (STOCK_CHECK == '1' && STOCK_ALLOW_CHECKOUT == '-1') { foreach ($osC_ShoppingCart->getProducts() as $product) { if (!$osC_ShoppingCart->isInStock($product['item_id'])) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'AUTO')); } } } }
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')); }
function _getOrderConfirmationForm() { global $osC_Language, $osC_ShoppingCart, $osC_Payment, $osC_Currencies, $osC_Tax; $osC_Language->load('account'); $osC_Language->load('checkout'); $osC_Language->load('order'); if (!is_object($osC_Payment)) { require_once 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); if ($osC_Payment->hasActive()) { $osC_Payment->pre_confirmation_check(); } } ob_start(); if (isset($_REQUEST['template']) && !empty($_REQUEST['template'])) { require_once 'templates/' . $_REQUEST['template'] . '/modules/order_confirmation_form.php'; } else { require_once 'includes/modules/order_confirmation_form.php'; } $form = ob_get_contents(); ob_end_clean(); return $form; }