# Frontend Templates überschreiben via Plugin ohne Theme? Windows Problem?

**URL:** https://forum.shopware.com/t/frontend-templates-uberschreiben-via-plugin-ohne-theme-windows-problem/59113
**Category:** Programmierung
**Created:** [16. April 2019 um 14:43 UTC](https://forum.shopware.com/t/frontend-templates-uberschreiben-via-plugin-ohne-theme-windows-problem/59113 "2019-04-16T14:43:32Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![MrFrox](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@MrFrox](https://forum.shopware.com/u/MrFrox)
#### Post date: [17. April 2019 um 13:44 UTC](https://forum.shopware.com/t/frontend-templates-uberschreiben-via-plugin-ohne-theme-windows-problem/59113/4 "2019-04-17T13:44:57Z")

</div>

Ich kann dir gern zeigen, wie ich das gemacht habe und wie es bei mir funktioniert. Um dieses Template zu manipulieren, verwende ich (u.a.) folgende Struktur:

/SW\_ROOT\_FOLDER/custom/plugins/PluginName/

|\_\_\_ Resources/

&nbsp; &nbsp; &nbsp; |\_\_\_ views

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |\_\_\_ frontend/

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |\_\_\_ detail/

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|\_\_\_ content/

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |\_\_\_ buy\_container.tpl

&nbsp; &nbsp; &nbsp; |\_\_\_ services.xml

|\_\_\_ Subscriber/

&nbsp; &nbsp; &nbsp; |\_\_\_ RouteSubscriber.php

|\_\_\_ PluginName.php

Die Dateien sind wie folgt aufgebaut.

buy\_container.tpl:

```
{extends file="parent:frontend/detail/content/buy_container.tpl"}

{block name='frontend_detail_data_attributes'}
    {$smarty.block.parent}

    [mein inhalt]

{/block}

```

services.xml:

```
            %plugin_name.plugin_name%
            %plugin_name.plugin_dir%

```

RouteSubscriber.php:

```
 'onPostDispatch',
        ];
    }

    public function __construct($pluginName, $pluginDirectory)
    {
        $this->pluginDirectory = $pluginDirectory;
    }

    public function onPostDispatch(\Enlight_Controller_ActionEventArgs $args)
    {
        /** @var \Enlight_Controller_Action $controller */
        $controller = $args->get('subject');
        $view = $controller->View();

        $view->addTemplateDir($this->pluginDirectory . '/Resources/views');

        $request = $controller->Request();
        $response = $controller->Response();

    }
}

```

PluginName.php:

&nbsp;

---

_[View the full topic](https://forum.shopware.com/t/frontend-templates-uberschreiben-via-plugin-ohne-theme-windows-problem/59113)._
