E-Mail Templates

Ausgabe von Bestellinformationen

Im Standard-Mailtemplate von Shopware werden bereits alle Bestellinformationen ausgegeben. Diese können nach belieben angepasst werden, sodass mehr oder weniger Informationen übermittelt werden.

Ausgabe von bestimmten Feld-Werten im Template

{% set breite = nestedItem.payload.options|filter(option => option.group == "Breite") %}
Ihre gewählte Breite: {{ breite.option|raw }}

Ausgabe von HTML-Code in Labels

Falls HTML-Code in Feld-Labels oder Werten genutzt wird, muss das Standard-Template angepasst werden:

Suchen nach:

{% for option in nestedItem.payload.options %}
   {{ option.group }}: {{ option.option }}
   {% if nestedItem.payload.options|last != option %}
     {{ " | " }}
   {% endif %}
{% endfor %}

Ersetzen durch:

{% for option in nestedItem.payload.options %}
   {{ option.group|raw }}: {{ option.option|raw }}
   {% if nestedItem.payload.options|last != option %}
     {{ " | " }}
   {% endif %}
{% endfor %}

Durch |raw wird der HTML-Code umgewandelt.

Um Links aus Dateiuploads direkt in Mailtemplates auszugeben ist folgender Code notwendig:

Suchen nach:

{% for option in nestedItem.payload.options %}
   {{ option.group }}: {{ option.option }}
   {% if nestedItem.payload.options|last != option %}
     {{ " | " }}
   {% endif %}
{% endfor %}

Ersetzen durch:

{% for option in nestedItem.payload.options %}
  {{ option.group }}: 
  {% if option.configurator is defined and option.configurator.field_type == 'upload' %}
   <a href='{{ option.configurator.user_value.fileUrl}}'
            target="_blank">{{ option.configurator.user_value.fileName }}</a>
  {% else %}
      {{ option.option }}
  {% endif %}
  {% if nestedItem.payload.options|last != option %}
    {{ " | " }}
  {% endif %}
{% endfor %}

Ausgabe von dynamischem Produktbild

Bei aktiver Option "Dynamisches Produktbild speichern" steht das dynamische Produktbild auch in E-Mails zur Verfügung.

Suchen nach (ca. Zeile 35):

<td>{% if nestedItem.cover is defined and nestedItem.cover is not null %}<img src="{{ nestedItem.cover.url }}" width="75" height="auto"/>{% endif %}</td>

Ersetzen durch:

<td>
{% if lineItem.payload.neon_configurator.images.dynamicImage %}
    <img src="{{ lineItem.payload.neon_configurator.images.dynamicImage }}" class="img-fluid line-item-img" alt="" title="" loading="lazy">
{% else %}
    {% if nestedItem.cover is defined and nestedItem.cover is not null %}
        <img src="{{ nestedItem.cover.url }}" width="75" height="auto"/>
    {% endif %}
{% endif %}
</td>

Last updated