Skip to content

Commit

Permalink
fix blacklist in products list preview and sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
androshchuk committed Jun 18, 2019
1 parent 1129ec8 commit 8c0d4f2
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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());
}

Expand Down

0 comments on commit 8c0d4f2

Please sign in to comment.