function __construct($controller, $name, $nameOfProductsBeingSearched = "", $productsToSearch = null) { $this->isShortForm = true; parent::__construct($controller, $name, $nameOfProductsBeingSearched, $productsToSearch); $oldData = Session::get(Config::inst()->get("ProductSearchForm", "form_data_session_variable")); if ($oldData && (is_array($oldData) || is_object($oldData))) { $this->loadDataFrom($oldData); } }
/** * returns a search form to search current products * * @return ProductSearchForm object */ function ProductSearchForm() { $onlySearchTitle = $this->originalTitle; if ($this->dataRecord instanceof ProductGroupSearchPage) { if ($this->HasSearchResults()) { $onlySearchTitle = "Last Search Results"; } } $form = ProductSearchForm::create($this, 'ProductSearchForm', $onlySearchTitle, $this->currentInitialProducts(null, $this->getMyUserPreferencesDefault("FILTER"))); $filterGetVariable = $this->getSortFilterDisplayNames("FILTER", "getVariable"); $sortGetVariable = $this->getSortFilterDisplayNames("SORT", "getVariable"); $additionalGetParameters = $filterGetVariable . "=" . $this->getMyUserPreferencesDefault("FILTER") . "&" . $sortGetVariable . "=" . $this->getMyUserPreferencesDefault("SORT"); $form->setAdditionalGetParameters($additionalGetParameters); return $form; }