Developer forum

Forum » Ecommerce - Standard features » Order flow emails based on page

Order flow emails based on page

Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi,

Using the shopping cart app we can select a page to be sent as the email, in Swift is called System Emails. That setting is missing in order flow emails, are there any plans to apply it there as well? That would be great for shipping emails etc.

Thanks,
BR Mario


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

There are no plans to add it for order flow emails. There are technical reasons for that - all kinds of issues since those emails are not in the context of the frontend.

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

That makes sense to ensure the platform settings are logical and context aware (where applicable).

 

I'm assuming though we could work around it somehow. It's because of the customer's perception, so letting them configure both emails using System Emails is a consistent experience. So I'm wondering if we can use a notification subscriber and override the template file and point to a page (take the order's page ID and from there get a page with a Navigation Tag to know which one is the Shipping Confirmation email).

 

Is that even doable? And if so, could you point me to a place in the source code of DW of how we can get the content of a page instead of a template?

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

You can't - or at least we have not found a viable solution for it yet.

The orderflow emails contains a lot of information regarding the order and order state and that needs to be rendered on a given page. That functionality is not around. Using the {} format is fine for simple information, but cannot render an entire order state information. 

You can call PageView.GetPageviewAsTemplate to get a pageview in your flow template. On that page insert {BodyOfFlowEmail} or something as a placeholder, take the markup returned from GetPageviewAsTemplate, put it in a template object, call SetTag("BodyOfFlowEmail", someMeaningFullMarkupString) and print out the result of template.Output()

Klunky and hardcoded, but could work, but no promises.

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

That's great info. I see that it's not perfect, but at least it's something we can explore with our most demanding customers. 

If we happen to find an elegant solution, I'll share it, otherwise I'll spare you the "rubish" :)

 

Thank you,

Nuno Aguiar

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

Mario figured out a way to achieve this. It's not fantastic, but works. Maybe you and your team can improve on it.

 

  • It's a template - so no dlls nor changes to the backend
  • It checks for a navigation tag "Email_{OrderStateId}" - our workaround for the absence of a page selector; also makes it possible to use in multiple websites
  • We haven't built a workaround to use actual template markup, but we could
  • We have to re-implement the private method CartUrl (otherwise we could have saved 20 lines of code)

 

Right now seems like an acceptable solution, saving us a considerable amount of customization hours as customers want to get emails on Quotes and Orders for various state updates.

 

I'm attaching the template, also in case somebody else wants to take it for a spin and improve on it.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Nuno

Great Sherlock homes work! Good find.

BR Nicolai

 

You must be logged in to post in the forum