Question

Is it possible to preview email template page from Hybris CMS cockpit? When I select usual page template, preview works fine. But when I select some email template, preview button becomes inactive. What I want to achieve is to preview rendered from velocity template email body.

P.S. I'm using hybris 5.0.4 Commerce Suite.

Was it helpful?

Solution

No, there is no out of the box way to do this. The EmailTemplates are expected to be rendered from Velocity markup and CMS components, with the appropriate Context of Customer and Order.

Adding this in the cockpit to render the email in the screen will be significant customisation. It would require integration of the RendererService and using it to render the body. You would need to determine ways of creating the appropriate Context, which is usually set in the preview token sent to your frontend application. You will probably want to replace all of this for Emails with something that renders in process.

Another solution could be to add a new Wizard to the cockpit. These are fairly easy to create. You could have steps to select a User (probably your own account?) and an Order (with items you want to see? or maybe use InMemoryCart to fill in what you want? hard...) put these in an appropriate context and fire off the right Event. Then the system can do all the rendering for you and email you the result.

For extra points you could re-purpose the preview button to open this Wizard when you are looking at an EmailTemplate when it would be otherwise grayed out.

If you do all this, I wantz teh codez.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top