/** * init * * @param Controller $controller the controller object * @param array $params additional parameters * @param array $preferences array with preferences * @param bool $barebone is the form initialized completely? * * @return void * * @author Sebastian Diel <*****@*****.**>, * Sascha Koehler <*****@*****.**> * @since 15.11.2014 */ public function __construct($controller, $params = null, $preferences = null, $barebone = false) { parent::__construct($controller, $params, $preferences, $barebone); if (!$barebone) { /* * redirect a user if his cart is empty and no order exists */ $checkoutData = $this->controller->getCombinedStepData(); if (!SilvercartCustomer::currentUser() || !SilvercartCustomer::currentUser()->getCart()->isFilled() && !array_key_exists('orderId', $checkoutData)) { if (!$this->getController()->redirectedTo()) { $frontPage = SilvercartPage_Controller::PageByIdentifierCode(); $this->getController()->redirect($frontPage->RelativeLink()); } } } }