Magento2: Visibility is not respected by layered nav counts

Created on 15 Jul 2016  路  16Comments  路  Source: magento/magento2

Steps to reproduce

  1. Have a category set up with layered navigation.
  2. Set one of that category's products visibility to "Search" (not visible on category directly).
  3. Browse to the category
  4. Filter the category by an attribute assigned to the product edited in step 2.

    Expected result

  5. Results count in pagination and layered navigation will match the number of products displayed.

    Actual result

  6. Results count will include products set to not visible on categories. The actual product list will not, creating a discrepancy.

2016-07-15_155136

Technical Info

I traced the issue back to \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection::_renderFiltersBefore() (this is where $this->_totalRecords is set, from the search result). The search result returns 14 entity IDs matching the layered navigation criteria. The actual product list load ($this, in that class context) loads products in the category matching those results, with some other filters.

I took the product list collection query, added the entity_id results explicitly, and then picked out constraints to find the difference. Visibility was it: There are 5 set to visibility 4 (the number of actual results shown), and 9 set to 3 (search-only), for a total of 14 (the total results count shown above).

2016-07-15_155233

Best guess is that use of a search results object in the context of layered navigation is making Magento think 'search!' and ignore that it's actually on a category.

Issue occurs on both 2.0.6 and 2.1.0.

Catalog Fixed in 2.1.x Fixed in 2.2.x Fixed in 2.3.x Clear Description Confirmed Format is not valid Ready for Work bug report

Most helpful comment

This issue persists in Magento 2 EE 2.1.6

All 16 comments

We are facing exactly same issue with toolbar. Is there any solution for this issue?

Same here...
Workaround?

+1
snip_20160928154259

Thanks for reporting the issue. Here is the public PR https://github.com/magento/magento2/pull/6035 but seems to be stuck
Internal issue MAGETWO-59127

+1:
2.1.2,
2.1.3,
2.0.11

@dmitry-fedyuk

fixed #7968

@shuaiZend I'm running into the same issue. Just updated to 2.1.3, ran "setup:upgrade", "di:compile", "indexer:reindex", "c:f" and the problem still persists.

Is there anything else to fix this issue? Thanks.

@shuaiZend Not fixed...It is actually a completely different problem. That issue is the 500 product limit per category.

This issue persists in Magento 2 CE 2.1.5

This issue persists in Magento 2 EE 2.1.6

Issue is still present on 2.1.7. Please fix this guys. What's the point of allowing us to set a product's visibility to "Search" only if the toolbar pagination and count totals still see it on category pages?? I hope you are aware of this issue

I'm responding to my own post from just above. It just occurred to me that if a product is set to be visible in "Search" only, it does not need to be in a category. The pagination issue can be fixed by simply untagging the search only products from all categories.

I tried the fix/ workaround from https://github.com/magento/magento2/pull/6035 but without any luck.
The results are the same.
Anybody?

still buggy in 2.1.9, even without filtering layer category.
3 products in "search" visibilty, 5 in "catalog search" visibility. Magento should display the label "5 products".
Sum from filters is equal to 5, but on the top of the product list, still "8 products".

@rhoerr, thank you for your report.
The issue is already fixed in develop branch, 2.2.0, 2.1.9

Was this page helpful?
0 / 5 - 0 ratings