Which function is triggered filterable attributes for the products on category page Magento 2
-
05-10-2020 - |
Question
Which function is triggered when clicking on any filterable attributes for the products on category page Magento 2?
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