Skip to content

Commit

Permalink
Merge pull request #1430 from androshchuk/1421-fix-blacklist
Browse files Browse the repository at this point in the history
fix blacklist in products list preview and sorting
  • Loading branch information
romainruaud authored Jul 8, 2019
2 parents b39afe4 + ce192ea commit b8e482a
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 b8e482a

Please sign in to comment.