Hide menu Last updated: Oct 12 2015

Episerver Commerce includes a TemplateService, which allows you to generate email notification texts for your site. The TemplateService uses a provider model (XslTemplateProvider) to let different providers generate the text of custom email. This provider uses XSL to convert an order and an XSL file into a custom formatted message. See the Notifications section for information about this service and usage examples.

Classes in this topic are available in the Mediachase.Commerce.Engine.Template namespace.

Creating a custom message

Use/modify one of the existing templates to create your own. The templates reference a common XSL document, order-shared.xsl, for common elements, like the footer and line item formatting. For information about creating XSL and XslTemplateProvider, see Using the XslCompiledTransform Class on MSDN.

Creating a message in a different language

Create a new folder in your Templates folder. Give the folder a name that corresponds to the CultureInfo name for the language you want to support with a new message template. Create and save the XSL template in this folder, translated to that language. To use the template, call the TemplateService.Process() method, passing in the name of the template (minus the xsl extension).

Creating a template provider

Providers need to be registered in the web.config file. Use the XslTemplateProvider registration in the web.config file as a guide. Each registration must have a name, type, applicationName, and templateSource path. The provider must inherit from TemplateProvider.

Comments