/** * Get search conditions TODO refactor with XLite\Controller\Admin\ProductList::getConditions() * * @return array */ protected function getConditions() { $searchParams = \XLite\Core\Session::getInstance()->{\XLite\View\ItemsList\Product\Customer\Search::getSessionCellName()}; if (!is_array($searchParams)) { $searchParams = array(); } return $searchParams; }
/** * Define so called "request" parameters * * @return void */ protected function defineRequestParams() { parent::defineRequestParams(); $this->requestParams = array_merge($this->requestParams, \XLite\View\ItemsList\Product\Customer\Search::getSearchParams()); }
/** * Return params list to use for search * TODO refactor * * @return \XLite\Core\CommonCell */ protected function getSearchCondition() { $result = parent::getSearchCondition(); foreach (\XLite\View\ItemsList\Product\Customer\Search::getSearchParams() as $modelParam => $requestParam) { $paramValue = $this->getParam($requestParam); if ('' !== $paramValue && 0 !== $paramValue) { $result->{$modelParam} = $paramValue; } } return $result; }
/** * Return products list * * @param \XLite\Core\CommonCell $cnd Search condition * @param boolean $countOnly Return items list or only its size OPTIONAL * * @return array|integer */ protected function getData(\XLite\Core\CommonCell $cnd, $countOnly = false) { return \XLite\Module\QSL\CloudSearch\Main::doSearch() && $cnd->{static::PARAM_SUBSTRING} ? \XLite\Core\Database::getRepo('\\XLite\\Model\\Product')->searchViaCloudSearch($cnd, $countOnly) : parent::getData($cnd, $countOnly); }