Register Shopping cart (0)
You have no items in your shopping cart.
Free nopCommerce Hosting

Blog posts tagged with 'message templates'

Rendering nopCommerce MessageTemplate Using Razor

When it comes to e-mails, nopCommerce has a very flexible Message Templates system to render e-mails by replacing what are called Tokens with actual values. For example, %Customer.FullName% will be replaced by a customer's full name.

While nopCommerce's Message Templates system is flexible enough to handle most scenarios (version 3.50 even supports attaching a static file), there are at least 2 deficiency with the implementation:

  1. Conditional rendering (if... then... else...) is not allowed
  2. Common layout has to be copied over to each and every Message Templates

To overcome these shortcomings, we can make use of Microsoft's powerful rendering engine - Razor. I believe most MVC developers are vary familiar with Razor syntax.

Below I'll show a proof-of-concept of using Razor engine to render Message Templates.

Hello, welcome to pro nopCommerce!

I am Woon Cherk, an nop mvp; and this blog is the place where I share my experiences developing nopCommerce themes and nopCommerce plugins. I also give out free nopCommerce plugins and free nopCommerce themes from time to time, make sure you subscribe to our e-mail newsletter to get updates and freebies! Click here to read more about me.