Which model use in toolbar and filter on product listing page? I need to rewrite collection, but can't find it. I use event

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_block_product_list_collection">
        <observer name="my_filter instance="Dv\MyFilter\Observer\Myfilter"/>

Code in observer

public function execute(\Magento\Framework\Event\Observer $observer)

    $event    = $observer->getEvent();
    $event->getCollection()->addAttributeToFilter('my_attr', ['eq' => '1']);;


and it works only for product collections in listing. How I can update collection for toolbar and filter navigation?

  • describe what you have try. – Dhiren Vasoya Jan 16 '17 at 5:35
  • @DhirenVasoya i edit and explain it in answer – omelandr Jan 16 '17 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.