Skip to content

Category Layered Filter Issue #2121

@kost08

Description

@kost08

When you search for something, using sample data for example, a 'bag' no category filters are displayed. That happens because category filters are only rendered if Category in $categories has no children categories. In Magento\CatalogSearch\Model\Layer\Filter\Category in ::_getItemsData() $category is Default Category and $categories is a collection of it's direct children categories.
1
But $optionsFacetedData is an array of Categories which are children of the $categories
2
When you check

...
foreach ($categories as $category) {
    if ($category->getIsActive()
        -> && isset($optionsFacetedData[$category->getId()]) <-
        && $this->isOptionReducesResults($optionsFacetedData[$category->getId()]['count'], $collectionSize)
) {
...

There is no match and filters aren't rendered.

Metadata

Metadata

Assignees

Labels

Issue: 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