# How overwrite default template smarty file from shopware tpl files by plugin?

**URL:** <https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904>\
**Category:** Plugins\
**Created:** [6. Juni 2019 um 13:52 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904 "2019-06-06T13:52:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![komoito](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@komoito](https://forum.shopware.com/u/komoito)\
**Post date:** [6. Juni 2019 um 13:52 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904/1 "2019-06-06T13:52:03Z")

</div>

Hi Guys!

I am working with Shopware learning course in Udemy [[link](https://www.udemy.com/developer-training-basic-english/learn/lecture/9057622)], and i got stuck in the end. The stuck is at the last chapter Subscriber methods and global events. Currently im struggling with &nbsp;hide default search by shouting the event and change the default template directory. I follow step by step and still doesn’t know how i can achieve the same efect as the course trainer. Could you guys help me?&nbsp;

I am using:

Shopware 5.5.8  
Windows 10 Professional OS  
XAMP with 7.2 PHP version.&nbsp;

Github link to code with plugin:&nbsp;  
[[Link](https://github.com/tkomoszeski/Shopware-Demo-App/tree/master/custom/plugins/TkStartup)]

Here is the code for my TkStartup plugin:

```
 'onPreDispatchTemplateRegistration'];
    }

    public function onPreDispatchTemplateRegistration(\Enlight_Event_EventArgs $args)
    {
        $controller = $args->getSubject();
        $templateDir = __DIR__. '/Resources/views';

        $controller->View()->addTemplateDir($templateDir);
    }
}

```

&nbsp;

And here is my catalog structures:

custom/Plugins/TkStartup – folder with my plugin  
and there i have&nbsp; Resources/views/frontend/index/search.tpl&nbsp; &nbsp;

And i have Controller like that:  
Routing Demonstration.php which i use to show my custom content of webpage.

The main goal is to hide search form input whenever it is hit to routingDemonstration controller.

Smarty code:&nbsp;

```
{extends file="parent:frontend/index/search.tpl"}
 {* Search field *}

{block name='frontend_index_search_container'}
 Nothing to search in here! 
{/block}

```

&nbsp; &nbsp; &nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)\
**Post date:** [6. Juni 2019 um 14:34 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904/2 "2019-06-06T14:34:32Z")

</div>

The path should be&nbsp;Resources/views/frontend/index/search.tpl&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![komoito](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@komoito](https://forum.shopware.com/u/komoito)\
**Post date:** [6. Juni 2019 um 14:54 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904/3 "2019-06-06T14:54:02Z")

</div>

> [@Shopwareianer schrieb:](https://forum.shopware.com/profile/15489/Shopwareianer "Shopwareianer")
> 
> The path should be&nbsp;Resources/views/frontend/index/search.tpl&nbsp;&nbsp;

I change it to&nbsp;lower&nbsp;case but it still doesn’t&nbsp;resolve the issue.&nbsp;

---

<div class="post-metadata">

**Author:** ![komoito](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@komoito](https://forum.shopware.com/u/komoito)\
**Post date:** [10. Juni 2019 um 09:51 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904/4 "2019-06-10T09:51:59Z")

</div>

Hi guys i managed to create working solution. All i had&nbsp;to do was&nbsp;to use vagrant to&nbsp;create my Ubuntu OS instance box where i deployed it. I used official&nbsp;shopware documentation in here:

[https://developers.shopware.com/developers-guide/vagrant-phpstorm/](https://developers.shopware.com/developers-guide/vagrant-phpstorm/)

So i managed it to work properly but I dont know why Windows it is not working the same way as it should work on Linux based systems.

I read about some stackoverflow topics that on WINDOWS OS we can’t this kind of things is it a bug ? Maybe I should report it ?&nbsp;

Here is a link to those two topics on stack:

[https://stackoverflow.com/questions/53416998/shopware-5-plugin-does-not-overwrite-template-view](https://stackoverflow.com/questions/53416998/shopware-5-plugin-does-not-overwrite-template-view)

[https://stackoverflow.com/questions/42819695/shopware-5-2-20-cannot-extend-template-via-plugin#comment72771135\_42826390](https://stackoverflow.com/questions/42819695/shopware-5-2-20-cannot-extend-template-via-plugin#comment72771135_42826390)

---

<div class="post-metadata">

**Author:** ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)\
**Post date:** [10. Juni 2019 um 10:12 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904/5 "2019-06-10T10:12:40Z")

</div>

Oh yeah … Shopware is having some issues with Windows and Linux is also recommended.

Maybe you should also take a look at vscode remote / ssh which was released a few weeks ago. So you can run your dev enviorement on a linux machine / server and connect to the server with vscode or even with a docker container:&nbsp;[https://code.visualstudio.com/docs/remote/remote-overview](https://code.visualstudio.com/docs/remote/remote-overview)

So you don’t need to run a VM on your machine.

---

<div class="post-metadata">

**Author:** ![reho](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@reho](https://forum.shopware.com/u/reho)\
**Post date:** [30. August 2019 um 13:12 UTC](https://forum.shopware.com/t/how-overwrite-default-template-smarty-file-from-shopware-tpl-files-by-plugin/59904/6 "2019-08-30T13:12:16Z")

</div>

Hello,

Is it possible in the near future to get this thing works on windows? I spent 2 days with a headache why my codes doesn’t working on my dev machine before finding this thread…  
I had very good impressions with Shopware but seems its getting away… ☹
