Issue
Override the Magento\Catalog\Model\Layer\FilterList
in Magento 2.2.3 using plugin. This error came
PHP message: PHP Fatal error: Uncaught TypeError: Argument 2 passed to ####\Plugin\Model\Layer\FilterList::aroundGetFilters() must implement interface Magento\Catalog\Model\Layer\FilterableAttributeListInterface, instance of Closure given, called in
/magento/framework/Interception/Interceptor.php on line 135 and defined in ####/Plugin/Model/Layer/FilterList.php:70
preference is not working on this file.
Solution
Using virtual_type
Once Verify the core file of di.xml arguments passing
..../modulename/extensionmodule/etc/frontend/di.xml
<virtualType name="categoryFilterList" type="ModuleName\ExtensionModule\Model\Layer\FilterList">
<arguments>
Your Passing Arguments(same as existing core file - di.xml(core module) passing arguments ).
</arguments>
</virtualType>
..../modulename/extensionmodule/Model\Layer
<?php
namespace ModuleName\ExtensionModule\Model\Layer;
/**
* Override FilterList Class
*/
class FilterList extends \Magento\Catalog\Model\Layer\FilterList
{
......Your Code Here......
}
?>
Answered By - Nandhini Nagaraj Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.