Mail Templates debuggen

Hey Leute,

Ich verzweifle gerade komplett an meinen Mail-Templates und finde meinen Fehler nicht. Hat jemand einen Tipp, wie ich das Ganze am besten debugge? Gibt es irgendwo die aktuellen Standard Mail Templates von Shopware? Möglich, dass in meinem Original schon ein Fehler drin ist.

Einfach das Template in x Blöcke unterteilen. Dann Block für Block testen, mit der Vorschau auf der rechten Seite.

hm…
Ja, für mich sieht das alles korrekt aus, die Mail wird trotzdem nicht verschickt :confounded:

Text Template

Bestellbestätigung

{% set currencyIsoCode = order.currency.isoCode %}
{% if order.orderCustomer.salutation %}{{ order.orderCustomer.salutation.translated.letterName ~ ' ' }}{% endif %}{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},

Ihre Bestellung ist am {{ order.orderDateTime|format_datetime('medium', 'short', locale='de-DE') }} bei uns eingegangen.
Wir haben Ihre Zahlung erhalten und werden Ihre Bestellung nun weiter verarbeiten.

Bestellnummer: {{ order.orderNumber }}
Bestellung ansehen unter: {{ rawUrl('frontend.account.order.single.page', { 'deepLinkCode': order.deepLinkCode }, salesChannel.domains|first.url) }}

Informationen zu Ihrer Bestellung

Pos.   Artikel-Nr.			Beschreibung			Menge			Preis			Summe
{% for lineItem in order.lineItems %}
{{ loop.index }}      {% if lineItem.payload.productNumber is defined %}{{ lineItem.payload.productNumber|u.wordwrap(80) }}{% endif %}				{{ lineItem.label|u.wordwrap(80) }}{% if lineItem.payload.options is defined and lineItem.payload.options|length >= 1 %}, {% for option in lineItem.payload.options %}{{ option.group }}: {{ option.option }}{% if lineItem.payload.options|last != option %}{{ " | " }}{% endif %}{% endfor %}{% endif %}{% if lineItem.payload.features is defined and lineItem.payload.features|length >= 1 %}{% set referencePriceFeatures = lineItem.payload.features|filter(feature => feature.type == 'referencePrice') %}{% if referencePriceFeatures|length >= 1 %}{% set referencePriceFeature = referencePriceFeatures|first %}, {{ referencePriceFeature.value.purchaseUnit }} {{ referencePriceFeature.value.unitName }}({{ referencePriceFeature.value.price|currency(currencyIsoCode) }}* / {{ referencePriceFeature.value.referenceUnit }} {{ referencePriceFeature.value.unitName }}){% endif %}{% endif %}
    {{ lineItem.quantity }}			{{ lineItem.unitPrice|currency(currencyIsoCode) }}			{{ lineItem.totalPrice|currency(currencyIsoCode) }}
{% endfor %}

{% set delivery = order.deliveries[0] %}

{% set displayRounded = order.totalRounding.interval != 0.01 or order.totalRounding.decimals != order.itemRounding.decimals %}
{% set decimals = order.totalRounding.decimals %}
{% set total = order.price.totalPrice %}
{% if displayRounded %}
    {% set total = order.price.rawTotal %}
    {% set decimals = order.itemRounding.decimals %}
{% endif %}

{% for shippingCost in order.deliveries %}
Versandkosten: {{ shippingCost.shippingCosts.totalPrice|currency(currencyIsoCode) }}
{% endfor %}
Gesamtkosten Netto: {{ order.amountNet|currency(currencyIsoCode) }}
{% for calculatedTax in order.price.calculatedTaxes %}
{% if order.taxStatus is same as('net') %}zzgl.{% else %}inkl.{% endif %} {{ calculatedTax.taxRate }}% MwSt. {{ calculatedTax.tax|currency(currencyIsoCode) }}
{% endfor %}
Gesamtkosten Brutto: {{ total|currency(currencyIsoCode,decimals=decimals) }}
{% if displayRounded %}
Gesamtkosten Brutto gerundet: {{ order.price.totalPrice|currency(currencyIsoCode,decimals=order.totalRounding.decimals) }}
{% endif %}


Zahlungsart: {{ order.transactions.first.paymentMethod.name }}
{{ order.transactions.first.paymentMethod.description }}
{% if order.transactions.first.paymentMethodId == "9682e2b9e63a488e95f55fa756853dcb" or order.transactions.paymentMethodId == "02e02f49f1ba40399a7973fb54450827" %}
Kontodaten für Zahlungen per Vorkassen oder Rechnung
Empfänger:	Ergobasis GmbH
Konto Nr.:	47972963
BLZ:        79050000
IBAN:	    DE26 7905 0000 0047 9729 63
SWIFT-BIC:	BYLADEM1SWU
Verwendungszweck: {{ order.orderNumber }}
{% endif %}

{% if delivery %}
Versandart: {{ delivery.shippingMethod.translated.name }}
{{ delivery.shippingMethod.translated.description }}
{% endif %}

{% set billingAddress = order.addresses[0] %}
Rechnungsadresse:
{% if billingAddress.company %}{{ billingAddress.company }}
{% endif %}{{ billingAddress.firstName }} {{ billingAddress.lastName }}
{{ billingAddress.street }}
{{ billingAddress.zipcode }} {{ billingAddress.city }}
{{ billingAddress.country.translated.name }}

{% if delivery %}
Lieferadresse:
{% if delivery.shippingOrderAddress.company %}{{ delivery.shippingOrderAddress.company }}
{% endif %}{{ delivery.shippingOrderAddress.firstName }} {{ delivery.shippingOrderAddress.lastName }}
{{ delivery.shippingOrderAddress.street }}
{{ delivery.shippingOrderAddress.zipcode}} {{ delivery.shippingOrderAddress.city }}
{{ delivery.shippingOrderAddress.country.translated.name }}
{% endif %}

{% if order.orderCustomer.vatIds %}
Ihre Umsatzsteuer-ID: {{ order.orderCustomer.vatIds|first }}
Bei erfolgreicher Prüfung und sofern Sie aus dem EU-Ausland
bestellen, erhalten Sie Ihre Ware umsatzsteuerbefreit.
{% endif %}

Hinweis: Im Anhang finden Sie die vollständige AGB und die ausführliche Widerrufsbelehrung. Zusätzlich können Sie die Informationen direkt auf unserer Webseite aufrufen unter: <a href="https://www.ergobasis.de/information/agb" target="_blank">AGB</a> und <a href="https://www.ergobasis.de/information/widerrufsbelehrung" target="_blank">Widerrufsbelehrung</a>.

HTML Template

<h2>Bestellbestätigung</h2>
{% set currencyIsoCode = order.currency.isoCode %}
<p>{% if order.orderCustomer.salutation %}{{ order.orderCustomer.salutation.translated.letterName ~ ' ' }}{% endif %}{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},</p>
<p>Ihre Bestellung ist am {{ order.orderDateTime|format_datetime('medium', 'short', locale='de-DE') }} bei uns eingegangen.</p>
<p><strong>Bestellnummer: {{ order.orderNumber }}</strong></p>
<p>Den aktuellen Status Ihrer Bestellung können Sie auch jederzeit auf unserer Webseite im Bereich "Mein Konto" - "Meine Bestellungen" abrufen:</p>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
	<tbody>
		<tr>
			<td align="left">
				<table role="presentation" border="0" cellpadding="0" cellspacing="0">
					<tbody>
						<tr>
							{% set orderURL = rawUrl('frontend.account.order.single.page', { 'deepLinkCode': order.deepLinkCode }, salesChannel.domains|first.url) %}
							<td><a href="{{ orderURL }}" target="_blank">bestellung ansehen</a></td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
	</tbody>
</table>
<p>&nbsp;</p>
<h2>Informationen zu Ihrer Bestellung</h2>
<table border="0" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; width:100%;">
    <tr>
        <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Produkt-Nr.</strong></td>
        <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Produktbild</strong></td>
        <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Bezeichnung</strong></td>
        <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Menge</strong></td>
        <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Preis</strong></td>
        <td bgcolor="#F7F7F2" style="border-bottom:1px solid #cccccc;"><strong>Summe</strong></td>
    </tr>

    {% for lineItem in order.lineItems %}
        {% set nestingLevel = 0 %}
        {% set nestedItem = lineItem %}
        {% block lineItem %}
            <tr>
                <td style="border-bottom:1px solid #cccccc;">{% if nestedItem.payload.productNumber is defined %}{{ nestedItem.payload.productNumber|u.wordwrap(80) }}{% endif %}</td>
                <td style="border-bottom:1px solid #cccccc;">{% if nestedItem.cover is defined and nestedItem.cover is not null %}<img src="{{ nestedItem.cover.url }}" width="75" height="auto"/>{% endif %}</td>
                <td style="border-bottom:1px solid #cccccc;">
                    {% if nestingLevel > 0 %}
                        {% for i in 1..nestingLevel %}
                            <span style="position: relative;">
                                <span style="display: inline-block;
                                    position: absolute;
                                    width: 6px;
                                    height: 20px;
                                    top: 0;
                                    border-left:  2px solid rgba(0, 0, 0, 0.15);
                                    margin-left: {{ i * 10 }}px;"></span>
                            </span>
                        {% endfor %}
                    {% endif %}

                    <div{% if nestingLevel > 0 %} style="padding-left: {{ (nestingLevel + 1) * 10 }}px"{% endif %}>
                        {{ nestedItem.label|u.wordwrap(80) }}
                    </div>

                    {% if nestedItem.payload.options is defined and nestedItem.payload.options|length >= 1 %}
                        <div>
                            {% for option in nestedItem.payload.options %}
                                {{ option.group }}: {{ option.option }}
                                {% if nestedItem.payload.options|last != option %}
                                    {{ " | " }}
                                {% endif %}
                            {% endfor %}
                        </div>
                    {% endif %}

                    {% if nestedItem.payload.features is defined and nestedItem.payload.features|length >= 1 %}
                        {% set referencePriceFeatures = nestedItem.payload.features|filter(feature => feature.type == 'referencePrice') %}
                        {% if referencePriceFeatures|length >= 1 %}
                            {% set referencePriceFeature = referencePriceFeatures|first %}
                            <div>
                                {{ referencePriceFeature.value.purchaseUnit }} {{ referencePriceFeature.value.unitName }}
                                ({{ referencePriceFeature.value.price|currency(currencyIsoCode) }}* / {{ referencePriceFeature.value.referenceUnit }} {{ referencePriceFeature.value.unitName }})
                            </div>
                        {% endif %}
                    {% endif %}
                </td>
                <td style="text-align: center;border-bottom:1px solid #cccccc;">{{ nestedItem.quantity }}</td>
                <td style="text-align: right;border-bottom:1px solid #cccccc;">{{ nestedItem.unitPrice|currency(currencyIsoCode) }}</td>
                <td style="text-align: right;border-bottom:1px solid #cccccc;">{{ nestedItem.totalPrice|currency(currencyIsoCode) }}</td>
            </tr>

            {% if nestedItem.children.count > 0 %}
                {% set nestingLevel = nestingLevel + 1 %}
                {% for lineItem in nestedItem.children %}
                    {% set nestedItem = lineItem %}
                    {{ block('lineItem') }}
                {% endfor %}
            {% endif %}
        {% endblock %}
    {% endfor %}
</table>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" style="margin-left:auto; margin-right:0px;">
	<tbody style="text-align: right;">
		{% set delivery = order.deliveries.first %}
		{% set displayRounded = order.totalRounding.interval != 0.01 or order.totalRounding.decimals != order.itemRounding.decimals %}
		{% set decimals = order.totalRounding.decimals %}
		{% set total = order.price.totalPrice %}
		{% if displayRounded %}
			{% set total = order.price.rawTotal %}
			{% set decimals = order.itemRounding.decimals %}
		{% endif %}
		{% for shippingCost in order.deliveries %}
			<tr>
				<td>Versandkosten: </td>
				<td>{{ shippingCost.shippingCosts.totalPrice|currency(currencyIsoCode) }}</td>
			</tr>
		{% endfor %}
		<tr>
			<td>Gesamtkosten Netto:</td>
			<td>{{ order.amountNet|currency(currencyIsoCode) }}</td>
		</tr>
        {% for calculatedTax in order.price.calculatedTaxes %}
			<tr>
				<td>{% if order.taxStatus is same as('net') %}zzgl.{% else %}inkl.{% endif %} {{ calculatedTax.taxRate }}% MwSt.:</td>
				<td>{{ calculatedTax.tax|currency(currencyIsoCode) }}</td>
			</tr>
        {% endfor %}
		<tr>
			<td>{% if not displayRounded %}<strong>{% endif %}Gesamtkosten Brutto:{% if not displayRounded %}<strong>{% endif %}</td>
			<td>{% if not displayRounded %}<strong>{% endif %}{{ total|currency(currencyIsoCode,decimals=decimals) }}{% if not displayRounded %}</strong>{% endif %}</td>
		</tr>
		{% if displayRounded %}
			<tr>
				<td><strong>Gesamtkosten Brutto gerundet:</strong></td>
				<td><strong>{{ order.price.totalPrice|currency(currencyIsoCode,decimals=order.totalRounding.decimals) }}</strong></td>
			</tr>
		{% endif %}
	</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
{% set delivery = order.deliveries[0] %}
{% set billingAddress = order.addresses[0] %}
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
	<tbody>
		<tr>
			<td>
				<h4 style="margin-bottom:10px;">Zahlungsart</h4>
				<p><strong>{{ order.transactions.first.paymentMethod.name }}</strong></p>
				<p>{{ order.transactions.first.paymentMethod.description }}</p>
				{% if order.transactions.first.paymentMethodId == "9682e2b9e63a488e95f55fa756853dcb" or order.transactions.paymentMethodId == "02e02f49f1ba40399a7973fb54450827" %}
                    <table style="margin-bottom: 15px;" cellpadding="0" cellspacing="0">
                    <tbody>
                    <tr>
                    <td colspan="2">Kontodaten für Zahlungen per Vorkasse oder Rechnung</td>
                    </tr>
                    <tr>
                    <td><strong>Empfänger</strong></td>
                    <td>Ergobasis GmbH</td>
                    </tr>
                    <tr>
                    <td><strong>Konto Nr.</strong></td>
                    <td>47972963</td>
                    </tr>
                    <tr>
                    <td><strong>BLZ</strong></td>
                    <td>79050000</td>
                    </tr>
                    <tr>
                    <td><strong>IBAN</strong></td>
                    <td>DE26 7905 0000 0047 9729 63</td>
                    </tr>
                    <tr>
                    <td><strong>SWIFT-BIC</strong></td>
                    <td>BYLADEM1SWU</td>
                    </tr>
                    <tr>
                    <td><strong>Verwendungszweck</strong></td>
                    <td>{{ order.orderNumber }}</td>
                    </tr>
                    </tbody>
                    </table>
                {% endif %}
			</td>
		</tr>
		{% if delivery %}
			<tr>
				<td>
					<h4>Versandart</h4>
    				<p><strong>{{ delivery.shippingMethod.translated.name }}</strong></p>
    				<p>{{ delivery.shippingMethod.translated.description }}</p>
				<td>
			</tr>
        {% endif %}
		<tr>
			<td>
				<h4>Rechnungsadresse</h4>
				<p>{% if billingAddress.company %}{{ billingAddress.company }}<br>{% endif %}
				{{ billingAddress.firstName }} {{ billingAddress.lastName }}<br>
				{{ billingAddress.street }} <br>
				{{ billingAddress.zipcode }} {{ billingAddress.city }}<br>
				{{ billingAddress.country.translated.name }}<br></p>
			</td>
		</tr>
		{% if delivery %}
			<tr>
				<td>
					<h4>Lieferadresse</h4>
					<p>{% if delivery.shippingOrderAddress.company %}{{ delivery.shippingOrderAddress.company }}<br>{% endif %}
					{{ delivery.shippingOrderAddress.firstName }} {{ delivery.shippingOrderAddress.lastName }}<br>
					{{ delivery.shippingOrderAddress.street }}<br>
					{{ delivery.shippingOrderAddress.zipcode}} {{ delivery.shippingOrderAddress.city }}<br>
					{{ delivery.shippingOrderAddress.country.translated.name }}<br></p>
				</td>
			</tr>
		{% endif %}
		{% if order.orderCustomer.vatIds %}
			<tr>
				<td>
					<p>Ihre Umsatzsteuer-ID: {{ order.orderCustomer.vatIds|first }}<br>Bei erfolgreicher Prüfung und sofern Sie aus dem EU-Ausland bestellen, erhalten Sie Ihre Ware umsatzsteuerbefreit.<br></p>
				</td>
			</tr>
		{% endif %}
		<tr>
			<td>
				<p>&nbsp;</p>
			</td>
		</tr>
		<tr>
			<td>
				<p>Hinweis: Im Anhang finden Sie die vollständige AGB und die ausführliche Widerrufsbelehrung. Zusätzlich können Sie die Informationen direkt auf unserer Webseite aufrufen unter: <a href="https://www.ergobasis.de/information/agb" target="_blank">AGB</a> und <a href="https://www.ergobasis.de/information/widerrufsbelehrung" target="_blank">Widerrufsbelehrung</a>.</p>
			</td>
		</tr>
	</tbody>
</table>

Kann man sich wirklich nirgendwo die aktuellen Shopware standard Templates ziehen?
Ich würde gerne die Variablen vergleichen, die von Shopware verwendet werden.

Hallo,

klar, wie alles andere auch bei GitHub, siehe: platform/de-html.html.twig at trunk · shopware/platform · GitHub .

Grüße
Sebastian

Vielen Dank, das habe ich schon vermutet, aber ich wusste einfach nicht unter welchem Ordner das ganze liegt.

Moin!

Hast du auch schon mal in den Ereignis-Log geschaut?
(Einstellungen → System → Ereignis-Log).
Vielleicht findest Du dort auch noch mehr Informationen.

LG;LA

Danke für den Hinweis. Mittlerweile hab ichs so weit, dass kein Error log mehr erstellt wird. Darfür bekomme ich einen Error von meinem Cronjob und die Mail hängt in der Queue fest, bis ich sie aus der Datenbank lösche :see_no_evil:
So langsam muss ich mich wohl damit abfinden, dass ich nur das standard Template nutzen kann.