1

Guys I'm stuck in the below issue for overriding core template file.

I'm trying to override default Magento search engine. I want to override core filter.phtml and toolbar.phtml

I get the products rendered into the frontpage, but my custom templates are not being used.

I get something like this:

enter image description here

I have to get these("Items", "Sort By", "Shipping Options") from toolbar.phtml which i'm not getting

enter image description here

Vendor\Module\view\frontend\layout\catalogsearch_result_index.xml

<?xml version="1.0"?>
 <referenceBlock name="catalogsearch.leftnav">
   <action method="setTemplate">
    <argument name="template" xsi:type="string">Vendor_Module::product/list/toolbar.phtml</argument>
   </action>
 </referenceBlock>

toolbar.phtml Is same code as core.

I doubt the block name in my xml, please suggest

1 Answer 1

4

You don't need to add any xml at all if you just want to override the file out-rightly. All you need to do is copy the file over to your theme and then make the changes in the newly copied file.

So you should copy the file to:

app/design/frontend/Company_Name/Theme_Name/Magento_Catalog/templates/product/list/toolbar.phtml

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.