coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
277 stars 157 forks source link

Store Context missing in Notification Messages #2661

Closed mindspace-devs closed 4 months ago

mindspace-devs commented 4 months ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes

With the changes from this pull request https://github.com/coreshop/CoreShop/pull/2565/files currency formatting and other Store related functions cannot be used anymore in Notification Messages (e.g. Order Confirmation Mail).

So in CoreShop 4.0.4 and up this doesn't work anymore. When testing this make sure to completely wipe the cache, ca:cl didn't do enough on my part

code for testing: {% import "@CoreShopFrontend/Common/Macro/currency.html.twig" as currency %} {{ currency.convertAndFormat(order.total) }}

dpfaffenbauer commented 4 months ago

We don't consider this a bug. The Frontend Macros are designed to be used with a context and a context only. On Emails, sent from CoreShop Notification, you cannot expect to have a right context set, even before the change. Sometimes emails are triggered from a Frontend Controller, sometimes they might get triggered via a Payment Webhook were the context is also different.

The context you need for emails is basically the order, everything is persisted in there.