Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Products List Preview and Sorting - Products disappear when set them to blacklist/invisible #1421

Closed
dimaMackert opened this issue Jun 6, 2019 · 2 comments
Assignees
Labels

Comments

@dimaMackert
Copy link
Contributor

dimaMackert commented Jun 6, 2019

Preconditions

Magento Version : 2.3.1

ElasticSuite Version : 2.8.0

Environment : dev

Third party modules : nothing relevant

Steps to reproduce

  1. Assign some products to a category
  2. Open the category, go to the overview 'Products List Preview and Sorting'
  3. Set some products to invisible/blacklist (the green eye in the top right corner)
  4. Save the settings and indexer:reindex

Expected result

  1. The invisible products should be visible as blacklisted products, to have the opportunity to set them back to the visible overview

Actual result

  1. Once indexer is finished, the products disappear from the overview, so you have no possibility to make the products visible again.

We created a workaround to get the product visible at the store views with around plugin for the : Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration class.

public function aroundGetFilters(ContainerConfiguration $subject, callable $proceed)
{
    $filters = [];

    /** @var \Smile\ElasticsuiteCore\Api\Search\Request\Container\FilterInterface $filter */
    foreach ($this->readBaseConfigParam('filters', $subject, []) as $name => $filter) {
        if ($name === 'blacklistedProducts' && ($subject->getName() === 'catalog_view_container') {
                continue;
        }
        $filters[] = $filter->getFilterQuery();
    }
     return array_filter($filters);
}

This turns off the blacklistedProducts $containerFilters. As I wrote above, this will work only on the store view level. If i set the product on the 'All Store Views' level to invisible, the product disappears on the 'All Store Views' AND also in the standard store (for me store_id = 3).

This behaviour may result from an incorrect handling of blacklist in the default scope (id=0) and index data from the default store view (in my case id=3) on reindex process.

@romainruaud
Copy link
Collaborator

Hello @dimaMackert

I understand your fix but it's quite "hacky" and cannot remain as is. As far as I remember, blacklisted products were shown properly on the BO when we implemented this feature, so it's more likely a regression on our side.

We'll try to reproduce this bug and to provide a fix for this one. Most probably, the blacklist filter should not be applied on the query which is used to fetch the preview of categories in BO. We should ensure the same issue is not occuring on the Search term result preview either.

Best regards, and thank you for reporting it.

@androshchuk can you try to reproduce this one and to provide an accurate fix ?

Regards

@romainruaud
Copy link
Collaborator

Fixed by PR #1430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants