Developer forum

Forum » Templates » Issue with Email Template Rendering

Issue with Email Template Rendering

Kevin Byrd
Kevin Byrd
Reply

For Order status changes, we have it set to send notification emails.  If the status changes per a front end button ("Submit order", etc), the emails render just fine.  But if we change the status of an order via the backoffice (company admin approving orders, etc) the notification emails fail to render completely.  Any ideas would be helpful.  This is unique to this project, other sites don't seem to have this issue, so I don't beleive it to be a DW issue.  Site has been updated to match the version of other sites where this functionality works as expected.  Here is the error message:


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Kevin

When the notifications are send from the backend they are not in the context of the frontend (Surprise !)

I think your template have some code that calls i.e. PageView which is a frontend context thing only. Or maybe som other frontend code only.

Try to look for something like that - or attach the template  in zip so we can have a look.

BR Nicolai

Votes for this answer: 1
 
Kevin Byrd
Kevin Byrd
Reply

Thanks Nicolai,  The template does have Pageview in some custom work someone added.  Thanks for bringing it to my attention.

 

Thanks,

Kevin

 

 
Kevin Byrd
Kevin Byrd
Reply

Nicolai,

We have been able to confirm that the issue with the cart is that the status email is being generated before the OrderCheckoutPageId field has a value on the EcomOrders table.  If we force a value there (the pageId for the cart page), the email will render the template.  I am assuming that data is populated in that field once the cart goes through checkout, however this seems incompatable with the status notfication feature for the cart/order drafts.

Can you please take a look?

 

Thanks!

Kevin

 
Nicolai Pedersen
Reply

But are you sending status mails before the checkout is completed? Can you describe the flow and provide a screendump of the setup of the order or cart flow that is causing this issue?

And maybe a bit of code from the part of the template that gives errors.

Thanks for elaborating.

Nicolai

 
Kevin Byrd
Kevin Byrd
Reply

Nicolai,

Yes we are, we have cart states established using Cart Flow.

The state change in question is when the cart goes from "New Request" (create on the front end by the customer) to "Submitted".  Submitted can be triggered by the front end user clicking a button to "submit the order for approval" or by the administrator by changing the state directly in the cart (see images below).

The error itself (as shown on an above reply) doesn't specify any actual code.  And the resolution/fix for the issue was discovered to be the OrderCheckoutPageId and forcing a value on the field prior to the order hitting the checkout.

I hope that helps to clarify it a bit more.

Thanks,

Kevin

 

You must be logged in to post in the forum