# Textbausteine im String Compiler (bzw. Mailtemplates)

**URL:** <https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168>\
**Category:** Programmierung\
**Created:** [4. April 2018 um 07:17 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168 "2018-04-04T07:17:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnebecker](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@arnebecker](https://forum.shopware.com/u/arnebecker)\
**Post date:** [4. April 2018 um 07:17 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/1 "2018-04-04T07:17:22Z")

</div>

Hallöle,

ich habe letztens versucht Textbausteine in Mailstemplates zu verwenden. Hat leider nicht funktioniert. Ich habe dann ein bisschen recherchiert. Für das compilieren der Mailtemplates wird die&nbsp;Shopware\_Components\_StringCompiler Klasse verwendet. Smarty unterstützt verschiedene Ressourcen und hier wird wohl eine Ressource vom Type String compiliert. Andere Ressourcen darin sind wohl nicht zulässig?!? In Shopware sind die Textbausteine scheinbar auch als eigene Ressource implementiert?!? Ist das richtig? Und wenn ja, wieso? Wieso sind die nicht einfach normale modifier oder functions? Gibt es eine Möglichkeit doch irgendwie Textbausteine in Mailvorlagen oder allgemein im StringCompiler zu verwenden?

VG Arne

---

<div class="post-metadata">

**Author:** ![vanwittlaer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/vanwittlaer/32/8499_2.png) [@vanwittlaer](https://forum.shopware.com/u/vanwittlaer)\
**Post date:** [4. April 2018 um 07:49 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/2 "2018-04-04T07:49:21Z")

</div>

Hi Arne,

eine ähnliche Frage hatte ich auch schon mal gestellt, aber konnte dann nicht richtig erklären, warum ich das gefragt hatte ☹ deswegen bin ich ab jetzt mal wieder ganz still 🙂

[https://forum.shopware.com/discussion/44241/textbausteine-nicht-in-produktexport-templates-verfuegbar](https://forum.shopware.com/discussion/44241/textbausteine-nicht-in-produktexport-templates-verfuegbar)

Happy selling,

Geert

---

<div class="post-metadata">

**Author:** ![arnebecker](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@arnebecker](https://forum.shopware.com/u/arnebecker)\
**Post date:** [6. April 2018 um 09:36 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/3 "2018-04-06T09:36:53Z")

</div>

Hat vielleicht jemand von SHopware ne Idee?

---

<div class="post-metadata">

**Author:** ![h\_lohaus](https://avatars.discourse-cdn.com/v4/letter/h/a587f6/32.png) [@h\_lohaus](https://forum.shopware.com/u/h_lohaus)\
**Post date:** [6. April 2018 um 09:45 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/4 "2018-04-06T09:45:43Z")

</div>

Hi,

du kannst den snippet-Modifier im Produktexport / Mail-Templates verwenden. Siehe:  
&nbsp;[Shopware 5 snippet management](https://developers.shopware.com/designers-guide/snippets/#using-dynamic-snippets)

Gruß Heiner

---

<div class="post-metadata">

**Author:** ![arnebecker](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@arnebecker](https://forum.shopware.com/u/arnebecker)\
**Post date:** [6. April 2018 um 10:07 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/5 "2018-04-06T10:07:19Z")

</div>

Funktioniert leider nicht ☹

```
{""|snippet:"payinadvanceAccountDetails":"documents/components"}

Syntax Error e1" on line 16 "{""|snippet:"payinadvanceAccountDetails":"documents/components"}" unknown modifier "snippet"

```

Ich habe auch die Variante mit den Variablen aus der Doku probiert. Und auch single statt double quotes.

---

<div class="post-metadata">

**Author:** ![vanwittlaer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/vanwittlaer/32/8499_2.png) [@vanwittlaer](https://forum.shopware.com/u/vanwittlaer)\
**Post date:** [6. April 2018 um 12:14 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/6 "2018-04-06T12:14:22Z")

</div>

Mir würde nur einfallen, einen eigene Function/Modifier zu schreiben, der den Textbausteine irgendwie per

```
$this->container->get('snippets')->getNamespace('blabla')->get('meinBaustein');

```

zu holen.

---

<div class="post-metadata">

**Author:** ![arnebecker](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@arnebecker](https://forum.shopware.com/u/arnebecker)\
**Post date:** [6. April 2018 um 12:18 UTC](https://forum.shopware.com/t/textbausteine-im-string-compiler-bzw-mailtemplates/52168/7 "2018-04-06T12:18:18Z")

</div>

Daran hatte ich auch schon gedacht. Ich dachte aber auch, dass es vielleicht einen Grund gibt (Performance?) wieso das so umständlich implementiert ist.
