4

I want set ifconfig configuration for below code:

First code in di.xml

<virtualType name="searchFilterList" type="Magento\Catalog\Model\Layer\FilterList">
    <arguments>
        <argument name="filters" xsi:type="array">
            <item name="attribute" xsi:type="string">KM\LayeredNavigation\Model\Layer\Filter\Attribute</item>
            <item name="price" xsi:type="string">KM\LayeredNavigation\Model\Layer\Filter\Price</item>
            <item name="decimal" xsi:type="string">KM\LayeredNavigation\Model\Layer\Filter\Decimal</item>
            <item name="category" xsi:type="string">KM\LayeredNavigation\Model\Layer\Filter\Category</item>
        </argument>
    </arguments>
</virtualType>

i was tried to put ifconfig on virtualtype tag but it's not working.

Second Code in di.xml

<type name="Magento\Catalog\Controller\Category\View">
    <plugin name="ajax_loader" type="KM\LayeredNavigation\Plugin\CategoryView" sortOrder="1" />
</type>

same as process above code.

can you please suggest how can i set the configuration or is there any alternative solution so please provide to me. It will helpful to me and also others.

Thanks

0

It's a third party code, but I'll try to answer. If you need to change filters type and layer type depending on configuration, then you might want to add a plugin for getFilters method of FilterList class and change layerResolver->create() statement in the action class. As of plugin, you can replace it with your own class and call parent method or your own one depending on configuration values: How to override or disable core Plugins in Magento2?

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.