From 8c0d4f2dc967fa337b8162fcb9b699c4e0ff53cc Mon Sep 17 00:00:00 2001 From: Dmytro Androshchuk Date: Tue, 18 Jun 2019 18:24:28 +0300 Subject: [PATCH] fix blacklist in products list preview and sorting --- .../Request/Container/Filter/CategoryBlacklist.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php b/src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php index e016136ca..8bc7ee850 100644 --- a/src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php +++ b/src/module-elasticsuite-virtual-category/Model/Product/Search/Request/Container/Filter/CategoryBlacklist.php @@ -36,18 +36,27 @@ class CategoryBlacklist implements FilterInterface */ private $searchContext; + /** + * + * @var \Magento\Framework\App\State + */ + private $state; + /** * Category Blacklist filter constructor. * * @param \Smile\ElasticsuiteCore\Search\Request\Query\QueryFactory $queryFactory Query factory. * @param \Smile\ElasticsuiteCore\Api\Search\ContextInterface $searchContext Current search context. + * @param \Magento\Framework\App\State $state Current state */ public function __construct( \Smile\ElasticsuiteCore\Search\Request\Query\QueryFactory $queryFactory, - \Smile\ElasticsuiteCore\Api\Search\ContextInterface $searchContext + \Smile\ElasticsuiteCore\Api\Search\ContextInterface $searchContext, + \Magento\Framework\App\State $state ) { $this->queryFactory = $queryFactory; $this->searchContext = $searchContext; + $this->state = $state; } /** @@ -56,7 +65,7 @@ public function __construct( public function getFilterQuery() { $query = null; - if ($this->searchContext->getCurrentCategory()) { + if ($this->searchContext->getCurrentCategory() && $this->state->getAreaCode() !== 'adminhtml') { $query = $this->getIsNotBlacklistedQuery((int) $this->searchContext->getCurrentCategory()->getId()); }