implement seach on content loop.
This commit is contained in:
@@ -18,6 +18,7 @@ use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Element\SearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
@@ -33,7 +34,7 @@ use Thelia\Type\BooleanOrBothType;
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
class Folder extends BaseI18nLoop implements PropelSearchLoopInterface, SearchLoopInterface
|
||||
{
|
||||
protected $timestampable = true;
|
||||
protected $versionable = true;
|
||||
@@ -62,6 +63,23 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array of available field to search in
|
||||
*/
|
||||
public function getSearchIn()
|
||||
{
|
||||
return [
|
||||
"title"
|
||||
];
|
||||
}
|
||||
|
||||
public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
|
||||
{
|
||||
$search->_and();
|
||||
|
||||
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".$searchCriteria." ?", $searchTerm, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$search = FolderQuery::create();
|
||||
|
||||
Reference in New Issue
Block a user