# Mail Template Salutation Probleme

**URL:** <https://forum.shopware.com/t/mail-template-salutation-probleme/100617>\
**Category:** Shopware 6 (German)\
**Created:** [25. Juli 2023 um 06:35 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617 "2023-07-25T06:35:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [25. Juli 2023 um 06:35 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/1 "2023-07-25T06:35:29Z")

</div>

Hallo Leute,

ich kämpfe mal wieder mit meinen Mail Templates, es ist eine unendliche Geschichte.  
Ist es irgendwie möglich die Anrede in z.B. der OrderConfirm anzupassen? Ich hätte gerne so etwas:  
Original

```auto
Hallo {% if order.orderCustomer.salutation %}{{ order.orderCustomer.salutation.translated.letterName ~ ' ' }}{% endif %}{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},<br>

```

Meine gewünschte Anpassung

```auto
{% if order.orderCustomer.salutation %}{{ order.orderCustomer.salutation.translated.letterName ~ ' ' }}{% else %}Sehr geehrte/er {% endif %}{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},<br>

```

Leider geht er aber nie in das else rein, wenn er die Salutation nicht hat, dann steht einfach nur der Name des Kunden da. Scheinbar ist das Arrayfeld immer gefüllt, aber öfters wohl mit nichts. Hat irgendjemand so etwas hinbekommen?  
Bitte melden!

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [25. Juli 2023 um 08:52 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/2 "2023-07-25T08:52:38Z")

</div>

Vielleicht in diesem Falle gezielt order.orderCustomer.salutation.salutationKey abfragen, erst wenn diese Abfrage nichts ergibt, dann else usw. usw.

---

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [25. Juli 2023 um 09:08 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/3 "2023-07-25T09:08:10Z")

</div>

Das probier ich direkt mal, vll klappts ja

---

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [25. Juli 2023 um 13:07 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/4 "2023-07-25T13:07:12Z")

</div>

Hat leider nicht geklappt, der else code wird immer noch ignoriert 🙄.

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [25. Juli 2023 um 13:21 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/5 "2023-07-25T13:21:17Z")

</div>

Vielleicht hat der Testuser an dieser Stelle ja keine korrekte Anrede?

---

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [26. Juli 2023 um 06:32 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/6 "2023-07-26T06:32:14Z")

</div>

Es betrifft immer die Gastbesteller über paypal und mit Amazon Login. Zumindest Paypal sollte ja funktionieren, außer Shopware hat mal wieder murks gebaut.

---

<div class="post-metadata">

**Author:** ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)\
**Post date:** [26. Juli 2023 um 06:41 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/7 "2023-07-26T06:41:44Z")

</div>

Vielleicht einfach mal so testen, kann ja nicht so schwer sein:

```auto
{% if order.orderCustomer.salutation.salutationKey == 'mr' || order.orderCustomer.salutation.salutationKey == 'mrs' %}
 {{ order.orderCustomer.salutation.translated.letterName }} 
{% else %}
 Hallo 
{% endif %}
{{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},

```

Wenn dann die Sache immer noch stimmt, muss es wohl an der Anrede liegen.

---

<div class="post-metadata">

**Author:** ![ergobasis](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@ergobasis](https://forum.shopware.com/u/ergobasis)\
**Post date:** [26. Juli 2023 um 07:26 UTC](https://forum.shopware.com/t/mail-template-salutation-probleme/100617/8 "2023-07-26T07:26:42Z")

</div>

Ja, das hat geklappt 🥳  
Vielen Dank.
