Skip to content

Settings and activity

1 result found

  1. 3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Patrick Lorenz commented  · 

    Workaround: Load orderEmployee Extension for Email Templates

    Problem: The orderEmployee extension from Shopware Commercial B2B is not automatically loaded when rendering order confirmation emails, even though it's available for storefront order views via OrderRouteRequestSubscriber.

    Solution: Create a MailService decorator that intercepts email sending and loads the missing extension before template rendering.
    and the use this in the 'Email Template':
    {% if order.extensions.orderEmployee is defined and order.extensions.orderEmployee|length > 0 %}
    {% set orderer = order.extensions.orderEmployee|first %}
    {{ orderer.firstName }} {{ orderer.lastName }}
    {% else %}
    {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }}
    {% endif %}

    Hint: use addExtension() instead of replacing the entire order entity to avoid serialization issues

    Patrick Lorenz supported this idea  ·