Skip to content

Visibility is not respected by layered nav counts #5670

@rhoerr

Description

@rhoerr

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

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

Actual result

  1. 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.

Metadata

Metadata

Assignees

Labels

Component: CatalogFixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions