/** * [searchSilvercartProducts description] * * @return void * * @author Patrick Schneider <*****@*****.**>, * Sebastian Diel <*****@*****.**> * @since 26.11.2013 */ protected function searchSilvercartProducts() { $SQL_start = $this->getSqlOffset(); $searchResultProducts = $this->buildSearchResultProducts(); if (!$searchResultProducts) { $searchResultProducts = new ArrayList(); } $this->searchResultProducts = $searchResultProducts; $productIdx = 0; if ($searchResultProducts) { $productAddCartFormName = $this->getCartFormName(); foreach ($searchResultProducts as $product) { $backlink = $this->Link() . "?start=" . $SQL_start; $productAddCartForm = new $productAddCartFormName($this, array('productID' => $product->ID, 'backLink' => $backlink)); $this->registerCustomHtmlForm('ProductAddCartForm' . $product->ID, $productAddCartForm); $product->productAddCartFormObj = $productAddCartForm; $productIdx++; } } // Register selector forms, e.g. the "products per page" selector $selectorForm = new SilvercartProductGroupPageSelectorsForm($this); $selectorForm->setSecurityTokenDisabled(); $selectorFormBottom = new SilvercartProductGroupPageSelectorsForm($this); $selectorFormBottom->setSecurityTokenDisabled(); $this->registerCustomHtmlForm('SilvercartProductGroupPageSelectors', $selectorForm); $this->registerCustomHtmlForm('SilvercartProductGroupPageSelectorsBottom', $selectorFormBottom); }
/** * execute these statements on object call * * @param bool $skip When set to true, the init routine will be skipped * * @return void * @author Roland Lehmann <*****@*****.**>, * Sebastian Diel <*****@*****.**> * @since 01.07.2013 */ public function init($skip = false) { parent::init(); if (!$skip) { if (isset($_GET['start'])) { $this->SQL_start = (int) $_GET['start']; } // there must be two way to initialize this controller: if ($this->isProductDetailView()) { // a product detail view is requested if (!$this->getDetailViewProduct()->isActive) { $this->redirect($this->PageByIdentifierCodeLink()); } $product = $this->getDetailViewProduct(); $this->registerCustomHtmlForm('SilvercartProductAddCartFormDetail' . $product->ID, new SilvercartProductAddCartFormDetail($this, array('productID' => $product->ID, '_REDIRECT_BACK_URL' => $this->BackLink()))); foreach ($product->WidgetArea()->Widgets() as $widget) { $widgetControllerClass = $widget->class . "_Controller"; if (class_exists($widgetControllerClass)) { $widgetController = new $widgetControllerClass($widget); if (method_exists($widgetController, 'registerCustomHtmlForms')) { $widgetController->registerCustomHtmlForms(); } } } } else { // a product group view is requested $this->initProductGroupPageProductForms(); // Register selector forms, e.g. the "products per page" selector $selectorForm = new SilvercartProductGroupPageSelectorsForm($this); $selectorForm->setSecurityTokenDisabled(); $selectorFormBottom = new SilvercartProductGroupPageSelectorsForm($this); $selectorFormBottom->setSecurityTokenDisabled(); $this->registerCustomHtmlForm('SilvercartProductGroupPageSelectors', $selectorForm); $this->registerCustomHtmlForm('SilvercartProductGroupPageSelectorsBottom', $selectorFormBottom); } } }