THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline


Hello,
my goal is to render a html content (user's order custom message) in email confirmation and notification template.

Having hook setup in module config.xml like this:

<hook id="order.comment.hook.email" class="OrderComment\Hook\EmailHook">
 <tag name="hook.event_listener" type="email" event="email-html.order-confirmation.before-products" method="onOrderConfirmation"/>
</hook>

and module template like this:

{loop type="order.comment.comment" name="order_comment_loop" order_id="$order_id"}
    <p>
        <strong>{intl l="Observations" d="ordercomment.bo.default"}</strong>:<br />
        {$ORDER_COMMENT|nl2br nofilter}
    </p>
{/loop}

In final received email I got duplicated content. One where is

{hook name="email-html.order-notification.before-products" order=$order_id}

which is correct, but another one where:

{hook name="email-html.order-notification.after-address" order=$order_id}

which is not correct.

Final email look like this:

Delivery address:
Mr. David
...

Billing address:
Mr. David
...

Observations:
message 14

Order Total: 15.40 €
Order Number: ORD000000000245
Paid With: Pay by Credit Card
Purchase Date: 11-13-2021 04:24:33
Delivery method: Custom Delivery

Observations:
message 14

I've removed cache manually and also run  php Thelia hook:clean, but it didn't help.

Thanks in advance for any suggestions.

Last edited by davidm (13-11-2021 18:13:22)


Thelia version 2.4.4.

Offline


After I added another hook for email-html.order-notification.before-products:

<tag name="hook.event_listener" type="email" event="email-html.order-notification.before-products" method="onOrderConfirmation"/>

it's rendered only once en an email, so problem has been solved. Just don't know how.


Thelia version 2.4.4.