Hallo liebes Forum,
ich möchte gerne die Lieferadresse (steht derzeit am Ende der Rechnung) rechts neben die Rechnungsadresse setzen und weiß nicht wie:
In welcher Datei ändert man das?
Danke und schöne Weihnachten
Ich weiß, dass das in \shopware\custom\plugins\MeinTheme\src\Resources\views\documents geändert wird. Kann mir jemans sagen in welchem Block sich der Abschnitt mit der Rechnungsadresse befindet?
Ja, das würde mich auch interessieren, wie man das machen kann.
Ganz unten in der Rechnung macht es aus meiner Sicht auch wenig Sinn, die Lieferadresse anzugeben…
Es ist kein Plugin nötig. Die Datei einfach im aktiven Theme ablegen:
<theme>/views/documents/invoice.html.twig
Code:
{% sw_extends '@Framework/documents/invoice.html.twig' %}
{% block document_recipient %}
{% set shippingAddress = order.deliveries.first.getShippingOrderAddress %}
{% set isDivergent = config.displayDivergentDeliveryAddress
and order.billingAddressId != order.deliveries.first.getShippingOrderAddressId %}
{% if isDivergent and shippingAddress %}
<table style="width: 130mm; border-collapse: collapse;">
<tr>
<td style="width: 50%; padding-right: 5mm;"></td>
<td style="width: 50%;"><span class="bold">{{ 'document.shippingAddress'|trans|sw_sanitize(null, true) }}</span></td>
</tr>
<tr>
<td style="width: 50%; vertical-align: top; padding-right: 5mm;">
{% sw_include '@Framework/snippets/render.html.twig' with {
format: billingAddress.country.translated.addressFormat,
address: billingAddress
} %}<br/>
</td>
<td style="width: 50%; vertical-align: top;">
{% if shippingAddress.company %}
{{ shippingAddress.company|sw_sanitize(null, true) }}<br>
{% endif %}
{% if shippingAddress.department %}
{{ shippingAddress.department|sw_sanitize(null, true) }}<br>
{% endif %}
{{ shippingAddress.firstName|sw_sanitize(null, true) }} {{ shippingAddress.lastName|sw_sanitize(null, true) }}<br>
{{ shippingAddress.street|sw_sanitize(null, true) }}<br>
{{ shippingAddress.zipcode|sw_sanitize(null, true) }} {{ shippingAddress.city|sw_sanitize(null, true) }}<br>
{{ shippingAddress.country.translated.name }}<br>
{% if shippingAddress.phoneNumber %}
{{ shippingAddress.phoneNumber|sw_sanitize(null, true) }}<br>
{% endif %}
</td>
</tr>
</table>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block shipping_address %}
{# Shopware gibt die Lieferadresse nochmal unterhalb der Positionen aus — hier unterdrücken #}
{% endblock %}
Danach bin/console cache:clear ausführen, oder Cache Unter Einstellungen leeren.
Hinweise:
'document.shippingAddress'|trans funktioniert im PDF-Kontext — eigene Snippet-Keys funktionieren dort nicht{{ parent() }} als Fallback wenn beide Adressen identisch sind → kein Layoutunterschiedshipping_address-Block verhindert die doppelte Ausgabe unterhalb der Positionen