public function process() { global $cookie; parent::process(); /* 4 steps to the order */ switch ((int) $this->step) { case -1: self::$smarty->assign('empty', 1); break; case 1: $this->_assignAddress(); break; case 2: $this->_assignAddress(); if (Tools::isSubmit('processAddress')) { $this->processAddress(); } $this->autoStep(); $this->_assignCarrier(); break; case 3: //Test that the conditions (so active) were accepted by the customer if ($cgv = Tools::getValue('cgv')) { $cookie->cgv = $cgv; } else { $cgv = isset($cookie->cgv) ? $cookie->cgv : false; } if (Configuration::get('PS_CONDITIONS') and (!Validate::isBool($cgv) or $cgv == false)) { Tools::redirect('order.php?step=2'); } $this->autoStep(); /* Bypass payment step if total is 0 */ if ($id_order = $this->_checkFreeOrder() and $id_order) { if (self::$cookie->is_guest) { $email = self::$cookie->email; self::$cookie->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('guest-tracking.php?id_order=' . (int) $id_order . '&email=' . urlencode($email)); } else { Tools::redirect('history.php'); } } $this->_assignPayment(); break; default: $this->_assignSummaryInformations(); break; } }
public function process() { parent::process(); /* 4 steps to the order */ switch ((int) $this->step) { case -1: self::$smarty->assign('empty', 1); break; case 1: $this->_assignAddress(); break; case 2: if (Tools::isSubmit('processAddress')) { $this->processAddress(); } $this->autoStep(); $this->_assignCarrier(); break; case 3: if (Tools::isSubmit('processCarrier')) { $this->processCarrier(); } $this->autoStep(); /* Bypass payment step if total is 0 */ if ($id_order = $this->_checkFreeOrder() and $id_order) { if (self::$cookie->is_guest) { $email = self::$cookie->email; self::$cookie->logout(); // If guest we clear the cookie for security reason Tools::redirect('guest-tracking.php?id_order=' . (int) $id_order . '&email=' . urlencode($email)); } else { Tools::redirect('history.php'); } } $this->_assignPayment(); break; default: $this->_assignSummaryInformations(); break; } }
public function process() { parent::process(); /* 4 steps to the order */ switch ((int) $this->step) { case -1: self::$smarty->assign('empty', 1); break; case 1: $this->_assignAddress(); break; case 2: if (Tools::getValue('id_address_delivery')) { $this->processAddress(2); if (sizeof($this->errors)) { break; } } $this->autoStep(); $this->_assignCarrier(); $this->autoStep(); $this->_assignAddress(); break; case 3: if (Tools::getValue('id_address_invoice')) { $this->processAddress(3); if (sizeof($this->errors)) { break; } } $this->autoStep(); //MOD: bypass carrier selection. select default carrier $this->processCarrier(); $this->autoStep(); /* Bypass payment step if total is 0 */ if ($id_order = $this->_checkFreeOrder() and $id_order) { if (self::$cookie->is_guest) { $email = self::$cookie->email; self::$cookie->logout(); // If guest we clear the cookie for security reason Tools::redirect('guest-tracking.php?id_order=' . (int) $id_order . '&email=' . urlencode($email)); } else { $customer = new Customer((int) self::$cookie->id_customer); Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $cart->id . '&id_module=FreeOrder' . '&id_order=' . (int) $id_order); } } self::$smarty->assign("mycurr", new Currency(intval(self::$cookie->id_currency))); $donate = Tools::getValue("donate", null); if (!empty($donate)) { self::$cookie->donate = $donate; } if (!isset(self::$cookie->donate)) { self::$cookie->donate = "yes"; } if (self::$cookie->donate === "yes") { $donation_amount = intval(Tools::getValue("donate_amt", null)); if (empty($donation_amount) || $donation_amount < 1) { $donation_amount = round(self::$cookie->donation_amount); if (empty($donation_amount) || $donation_amount < 1) { $donation_amount = 1; } } } else { $donation_amount = 0; } self::$cookie->donation_amount = $donation_amount; self::$smarty->assign("donate", self::$cookie->donate); self::$smarty->assign("donation_amount", self::$cookie->donation_amount); $this->_assignPayment(); break; default: break; } $this->_assignSummaryInformations(); }