/** * This module always requires a page model. */ public function requireDefaultRecords() { parent::requireDefaultRecords(); if (!self::get()->exists() && $this->config()->create_default_pages) { $page = self::create(array('Title' => 'Shopping Cart', 'URLSegment' => CartPage_Controller::config()->url_segment, 'ShowInMenus' => 0)); $page->write(); $page->publish('Stage', 'Live'); $page->flushCache(); DB::alteration_message('Cart page created', 'created'); } }
/** * standard controller function **/ function init() { //we retrieve the order in the parent page //the parent page also takes care of the security parent::init(); Requirements::themedCSS('Order'); Requirements::themedCSS('Order_Print', "print"); Requirements::javascript('ecommerce/javascript/EcomPayment.js'); //clear steps from checkout page otherwise in the next order //you go straight to the last step. }
/** * Standard SS function * if set to false, user can edit order, if set to true, user can only review order **/ public function init() { parent::init(); Requirements::themedCSS('CheckoutPage'); Requirements::javascript('ecommerce/javascript/EcomPayment.js'); Requirements::customScript(' if (typeof EcomOrderForm != "undefined") { EcomOrderForm.set_TermsAndConditionsMessage(\'' . convert::raw2js($this->TermsAndConditionsMessage) . '\'); }', "TermsAndConditionsMessage"); $this->steps = EcommerceConfig::get("CheckoutPage_Controller", "checkout_steps"); if ($this->HasCheckoutSteps) { $this->currentStep = $this->request->Param("ID"); if ($this->currentStep && in_array($this->currentStep, $this->steps)) { //do nothing } else { $this->currentStep = array_shift($this->steps); } } }
/** * Standard SS function * if set to false, user can edit order, if set to true, user can only review order **/ public function init() { parent::init(); Requirements::themedCSS('CheckoutPage', 'ecommerce'); $ajaxifyArray = EcommerceConfig::get("CheckoutPage_Controller", "ajaxify_steps"); if (count($ajaxifyArray)) { foreach ($ajaxifyArray as $js) { Requirements::javascript($js); } } Requirements::javascript('ecommerce/javascript/EcomPayment.js'); Requirements::customScript(' if (typeof EcomOrderForm != "undefined") { EcomOrderForm.set_TermsAndConditionsMessage(\'' . convert::raw2js($this->TermsAndConditionsMessage) . '\'); }', "TermsAndConditionsMessage"); $this->steps = EcommerceConfig::get("CheckoutPage_Controller", "checkout_steps"); $this->currentStep = $this->request->Param("ID"); if ($this->currentStep && in_array($this->currentStep, $this->steps)) { //do nothing } else { $this->currentStep = array_shift($this->steps); } //redirect to current order - // this is only applicable when people submit order (start to pay) // and then return back if ($checkoutPageCurrentOrderID = Session::get("CheckoutPageCurrentOrderID")) { if (!$this->currentOrder || $this->currentOrder->ID != $checkoutPageCurrentOrderID) { if ($order = Order::get_by_id_if_can_view(intval($checkoutPageCurrentOrderID))) { Session::clear("CheckoutPageCurrentOrderID"); Session::set("CheckoutPageCurrentOrderID", 0); Session::save(); return $this->redirect($order->Link()); } } } if ($this->currentOrder) { //we make sure all the OrderModifiers are up to date.... Session::set("CheckoutPageCurrentOrderID", $this->currentOrder->ID); } }
/** * standard controller function **/ function init() { //we retrieve the order in the parent page //the parent page also takes care of the security parent::init(); Requirements::themedCSS('Order', 'ecommerce'); Requirements::themedCSS('Order_Print', 'ecommerce', "print"); Requirements::themedCSS('CheckoutPage', 'ecommerce'); Requirements::javascript('ecommerce/javascript/EcomPayment.js'); Requirements::javascript('ecommerce/javascript/EcomPrintAndMail.js'); //clear steps from checkout page otherwise in the next order //you go straight to the last step. Session::clear("CheckoutPageCurrentOrderID"); Session::clear("CheckoutPageCurrentOrderID"); Session::set("CheckoutPageCurrentOrderID", 0); Session::save(); $this->includeGoogleAnalyticsCode(); }