if (!
$term || \
strlen($term) <
Shopware()->
Config()->
get('MinSearchLenght'
)) { return;
} $this->
setDefaultSorting();
/** @var ShopContextInterface $context */
$context =
$this->
get(\Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface::
class)->
getShopContext();
$criteria =
$this->
get(\Shopware\Bundle\SearchBundle\StoreFrontCriteriaFactoryInterface::
class) ->
createAjaxSearchCriteria($this->
Request(),
$context);
$result =
$this->
search($term,
$criteria,
$context);
if ($result->
getTotalCount() > 0
) { $products =
$this->
convertProducts($result);
$this->
View()->
assign('searchResult',
$result);
$this->
View()->
assign('sSearchRequest',
['sSearch' =>
$term]);
$this->
View()->
assign('sSearchResults',
[ 'sResults' =>
$products,
'sArticlesCount' =>
$result->
getTotalCount(),
]);
}