magento2 - Magento 2 - Product filters using Obeserver Event -


i trying create 1 observer apply additional filters product collection.

so use magento 2 event :catalog_product_collection_load_after

observer code :

 public function execute(\magento\framework\event\observer $observer)     {         $collection = $observer->getevent()->getcollection();         $collection->addattributetofilter('size',10);         return $this;     } 

but above code working fine product collection, showing wrong pagination , product count

same happen layer navigation.

is there solution that?


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -