How to override my custom catalogsearch block? and what is the equivalent class for below in magento2? and how to override in di?


My custom catalosearch override is as:

 <preference for="Magento\LayeredNavigation\Block\Navigation" type="Vendor\Module\Block\CatalogSearch\Layer" />

is that correct class? cause in magento1x , we do by

class Vendor_Module_Block_CatalogSearch_Layer extends Mage_CatalogSearch_Block_Layer {}

But in magento2, thr is no such Layer in CatalogSearch. Please suggest

1 Answer 1


You can use


  1. In this class the layer object getLayer returns \Magento\Catalog\Model\Layer.

  2. Also you can find some important layered navigation functions at Magento\Catalog\Model\LayerandLayer.php.

  3. You may not find ( Magento 1.X )exact or entire class in Magento 2 but we can identify the flow to customize or extend the functionality by using modules.

Assume you know how to extend or override core classes in Magento 2 ( Standard way is by creating custom module )

Hope this helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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