Portal | Homepage | Blog

Using and Customizing NSc Mail E-Mail Templates


#1

You can customize the content of the various e-mail messages that are automatically sent to your customers when they place orders on your WebStore. In addition, you can customize administrative e-mails, such as "Customer Registration" and "Forgot Password" messages.

The "Customer Registration", "Forgot Password", and "Order Confirmation" e-mails can be customized using NitroScript. If you have NitroScript access, in WebStore Manager, select Edit WebStore Layout, then under E-mails, select the appropriate template. 

All other e-mail messages generated by NSc Sync are customizable through the modification of XML template files.

Two templates, thankyou.xml and processed.xml, are defined by default in the NSc Sync...\MailTemplates installation directory: 

In newer versions of NSc Sync the templates will be found in C:\Users\Your_Username\AppData\Roaming\NitroSell\NSc Sync\MailTemplates

"Thank You" Template

When a Web Order is received during the synchronization process (using NSc Sync), the thankyou.xml template is used to generate an e-mail. This template generates an e-mail in the following format:

"Processed" Template

When a Web Order has been processed successfully from within RMS Store Operations POS (using NitroSell's Get Web Orders (GWO) add-on): 




and then tendered successfully from within RMS Store Operations POS, NSc Sync uses the processed.xml template to generate an email in the
following format:


Simply selecting "Set as Processed" for an order using GWO does not cause the processed.xml e-mail to be sent. In order for this e-mail to be generated and sent, the order must also be tendered successfully in your POS.

Custom Templates

The RMS GWO add-on enables the cashier to manually send an e-mail to the customer by selecting a custom template, for example, if an ordered item is placed on back order:

This will result in the generation and submission of an e-mail by NSc Sync, using the "Items on back order" template. Any number of custom e-mail templates can be created that enable manual e-mail submission to the customer through the GWO component. To do so, perform these steps:

  1. Create a new template XML file in the C:\Program Files\NitroSell\NSc Sync - RMSSO\Data\MailTemplates directory, note that this is the default directory if you have installed NSc Sync to a different directory you will need to adjust the path accordingly, (or copy an existing XML file and rename it), for example, itemsbackordered.xml:

  2. Modify the template file by giving it a description, and by setting ALLOWMANUAL to 1 .

  3. Modify the body of the message as appropriate.

  4. To ensure that NSc Sync uses your new template, after modifying the XML file, from the NSc Sync dialog menu, select File, then select Rescan Mail Templates...

  5. Open the Get Web Orders (GWO) component in RMS, click the drop-down beside Options, then select Send Feedback. Your new template "Items on back order" is displayed, ready for selection.

Modifying Templates

The e-mail templates are defined in XML and can be edited in any text editor. Each template consists of a combination of the e-mail content text and XML tags representing customer and order data that will be inserted into the content text on message generation.

For the majority of users, modification of the content text is sufficient. For example, modifying the thankyou.xml template involves the following:

  1. Open thankyou.xml in any text editor.

  2. The text within the XML BODY tag contains the content of the message:

  3. Two tags are used in this example: to output the user’s first name at the start of the message, and to output the store name at the end of the message.

  4. The content can contain HTML, allowing more sophisticated message layout. The content &lt;BR&gt; in the above example represents the HTML tag <BR>. The &lt; and &gt; tags represent alterative means of entering the less-than and greater-than angle brackets. This is necessary to distinguish HTML tags from XML tags, so as not to confuse the message generator.

  5. Modify the content, for example:



  6. To ensure that NSc Sync is always using the most up-to-date e-mail template files, after modifying an XML file, go to the File menu and click Rescan Mail Templates...

  7. Any generated ‘thank you’ message will be formatted in the following manner:


Modifying Templates (for Advanced Users Only)

Templates typically contain the text of the message, along with specialized XML tags to output order-related information, and to set generated e-mail properties.

Note: If you insert the appropriate code into the nitroasl_mailer table, you can instruct NSc Mail to send mails for Web Orders based on any template you define using these tags.

Mail Property Tags

Name

Children

Parent

Attributes 

Description

MAIL DESCRIPTION, ALLOWMANUAL, HEADERS, FIELD, DBFIELD, VARIABLE, SQL

None

None

Root XML template element.

DESCRIPTION

None

MAIL

None

Name of template.

ALLOWMANUAL

None

MAIL

None

If value is set to 1, template can be used by cashier to send manual e-mail.

HEADERS HEADER MAIL

None

Root tag for mail header settings.

HEADER FIELD, DBFIELD, VARIABLE, SQL HEADERS TYPE

E-mail header settings, where TYPEsubject, fromname, fromaddress, toname, toaddress.

can be one of:
BODY FIELD, DBFIELD, VARIABLE, SQL MAIL

None

Represents body of message.

Order Information Tags

Name 

Children

Parent

Attributes 

Description

FIELD

None

All

NAME, BASETAGIDENTIFIER, BASETAGVALUE

Extracts order information from the WebStore order, which is stored in a standard XML format recognized by RMS.

DBFIELD

None

All

TABLE, NAME

Outputs data from the RMS database, specifically, store and ordersummarystore table refers to the RMS configuration table. The ordersummary table refers to the RMS exchange table.

VARIABLE

None

All

NAME

Outputs data at the "processed" stage of an order only. NAME can have one of the following values:

  • cashieremailaddress (for example, 'alex@tailspintoys.com')

  • cashiername (for example, 'Alex Nayberg')

  • transactionnumber (for example, '104565')

  • shippingcarrier (for example, 'Consolidated Messenger')

  • shippingservice (for example, 'Five Day')

  • shippingtrackingnumber

  • shippingtrackingurl

SQL QUERY, ROW

All

None

Root tag for general SQL query.

QUERY

None

SQL

None

SQL query to be executed on RMS database, that is, any information can be retrieved from RMS and placed in your mail message.

ROW
COL
SQL

None

Text contents executed for each row returned by the query.

COL

None

ROW
NAME

NAME value refers to the table column.

Simple Example

The following example is a simple modification to the processed.xml template file, which is sent when a Web Order has been processed successfully:

Note: Any HTML specified in your template should be encoded so as not to confuse the XML parser.

To ensure NSc Sync is always using the most up-to-date e-mail template files, after modifying an XML file, from the NSc Sync File menu, select Rescan Mail Templates...

 

When a Web Order has been processed successfully, this will result in a mail in the following format being sent to the customer:

Hello John Smith, Your order is being processed!

Regards, Jane Jones,

Acme Stores Ltd.

Notes on Modifying E-mail Templates

  • A <QUERY> tag is processed in a <SQL> block like any regular query, however, it must be a SELECT query.

  • You can use any valid tags as parameters in SQL statements.

  • All tags are substituted as text in the SQL.

  • Only SQL SELECT statements (either one or multiple) are allowed.

  • A <QUERY> tag must return a result set, otherwise, the <SQL> is evaluated as empty. If the result set is empty, the entire <SQL> block is skipped.

  • A <SQL> tag creates an implicit loop in processing.

  • To code conditional processing with field values to output content only if a particular field value is seen, this logic can be inserted in your SQL statement using a CASE statement.

  • The e-mail that is generated is standard HTML. You should imbed as much as possible (that is, embed CSS styles instead of linking to a remotely hosted stylesheet). It is recommended that you keep the coding as simple as possible, that is, use only standard tags that are styled using CSS. Do not attempt to position content absolutely.

  • NSc  Sync supports rich-text e-mails only.

 

Send unique Templates for multiple WebStores 



<!-- Only send the mail if the order contains the domainname specified... -->
<ASSERTSQL>
    SELECT domainname from  nitrosell_weborderdetail where nitrosell_weborderdetail.weborderid = '<DBFIELD TABLE="ordersummary" NAME="ID"/>' and domainname='briantwo.demostore.nitrosell.com'
</ASSERTSQL>


Emails to customers
Despatch email specific to delivery method
#2

Hi,

With the order complete email, I’d like the content of the email to be different depending on whether the delivery method is COLLECT INSTORE or its for despatch. Is this possible?

eg For collect instore:
“This is a short notification email to let you know that we have now completed your order and it is ready for you to collect instore…”

For despatch:
"This is a short notification email to let you know that we have now processed your order and it will be despatched as soon as possible via xxxxx. They will contact you with a 1 hour delivery slot and you will be able to rearrange the date or give special instructions…

At the moment the email we send tries to cover both options but it doesn’t read well!

Thanks


#3

Hi again @emma,

This is certainly possible. We can create two copies of your processed.xml template and, in the header, you can specify an <AssertSQL> tag that governs whether each template gets sent.

@peter_szczepanowski: would you mind assisting Emma with this, please?

Thanks,
Donogh


#4

Hi @emma,

I have opened the ticket on your behalf where I will guide you through the process of customizing the emails.

Regards,

Peter


#5

There are multiple ways to change the e-mail content depending on the shipping method. One of them is using the <assertSQL> tag and creating multiple processed.xml files that would be sent depending on the result of SQL query. [Just like described here][1]

The other method enables you to use a single file by using <SQL> and <QUERY> tags.

<SQL>
<QUERY>
SELECT (CASE WHEN webordershipping LIKE '%store%' THEN 'Custom text for in-store pickup' ELSE 'Custom text for any other type of delivery' END) AS collectionpoint FROM nitrosell_weborder WHERE weborderid = <DBFIELD TABLE="ordersummary" NAME="ID"/>
</QUERY>
<ROW>
<COL NAME="collectionpoint"/>&lt;BR&gt;
</ROW>
</SQL>

As you can see the CASE statement contains texts that we later place as a <COL NAME=“collectionpoint”/> to be displayed in the e-mail content. This type of statement can be expanded to accommodate for any number of delivery methods.

Regards,

Peter
[1]: Using and Customizing NSc Mail E-Mail Templates