Preconditions
- Magento 2.1.1
- Using Ubuntu/trusty64 vagrant-box, php7, apache
Steps to reproduce
- Add a new custom module
Update etc/di.xml in your custom module
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection" type="Sanimarkt\App\Model\ResourceModel\Fulltext\Collection" /> </config>
Add new Collection.php file and override
_renderFiltersBefore()
methodnamespace Sanimarkt\App\Model\ResourceModel\Fulltext; class Collection extends \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection { protected function _renderFiltersBefore() { die('stopping here') } }
clear cache
- Make a search request
Expected result
- The search request should stop and show 'stopping here' on the screen
Actual result
- Nothing happens the custom class
Sanimarkt\App\Model\ResourceModel\Fulltext\Collection.php
is not executed.