Question

Which function is triggered when clicking on any filterable attributes for the products on category page Magento 2?

Était-ce utile?

La solution

It depends on the filter type.
All filter models implement the interface \Magento\Catalog\Model\Layer\Filter\FilterInterface.
This interface contains (among others) a method called apply.

Depending on the attribute type, the method apply from different implementations of this interface is called.
For example, for price filter \Magento\Catalog\Model\Layer\Filter\Price::apply() is called.
For dropdown and multiselect attributes \Magento\Catalog\Model\Layer\Filter\Attribute::apply is called.
For category filter \Magento\Catalog\Model\Layer\Filter\Category::apply and for decimal attributes \Magento\Catalog\Model\Layer\Filter\Decimal::apply

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top