1

There is a way to exclude from the count, in the layered navigation, child product that have the filter attribute? For example: I have a product A with attribute region set to "tuscany", and I have also a bundle B which contains the product A, but the bundle doesn't have the region attribute set. What I get in layered navigation for region filter "tuscany" is 2, but I don't want to include in the count the bundle's child items.

asked May 17, 2017 at 13:13
1
  • No clue so far? Commented Jul 3, 2017 at 17:54

1 Answer 1

0

I have found a solution: Ive created a plugin on the indexer

<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\AbstractIndexer">
 <plugin name="excludeBundleFromCount" type="Vendor\FilteredNavigation\Plugin\Indexer\AbstractIndexer"/>
</type>

and the class:

namespace Vendor\FilteredNavigation\Plugin\Indexer;
class AbstractIndexer
{
 public function aroundGetRelationsByParent(
 \Magento\Catalog\Model\ResourceModel\Product\Indexer\AbstractIndexer $subject,
 \Closure $proceed,
 $parentIds
 ) {
 return [];
 }
}

so all the save on bundle item doesn't create an index entry for the attribute.

Not the beatiful and elegant way but it does its job.

answered Jul 4, 2017 at 14:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.