Home > The Template System > Process Templates > The Order Email Template

Table of Contents

DotAdmin User Guide

The Order Email Template

Important! Emails created using the Order Email template are all sent as plain-text. You should not include HTML in this template.

When an order is completed, an email can optionally be sent to both the merchant and the customer to summarise the order details. The merchant's email can optionally be formatted to just give notification that a new order has been taken, omitting the full details of the order. These settings can be changed in the Store Settings area of the dotAdmin system.

The order confirmation emails are sent when the callback process runs, and many of the template instructions found here are the same as those found in the callback template, because this template provides a similar service (displaying a confirmation notice and a receipt).

The only real difference between this template and the callback template is that the contents of the shopping cart cannot be included in the same way. This is because the shopping cart template is HTML, and we are sending a plain-text email.

Merchant-Specific Template Instructions

Any messages intended solely for the merchant should be enclosed within a IF {merchant} condition. Messages strictly for the customer can use an ELSE condition.

The first template instruction in the order email template is shown in the example below:

<!-- IF  {merchant} -->
  {mail_notify_body}{header}

  Complete details of this transaction are available at your
  website: <>
<!-- /IF  {merchant} -->

<!-- ELSE -->Hi
  <!--BLOCK {contacts}-->
    {f_name}
  <!--/BLOCK {contacts}-->
  Thank you for your order. This confirms that we have received
  your order. If you have any queries regarding your order, please
  email us at the address below
<!-- /ELSE -->

Providing different messages for the merchant and customer in the Order Email template.

Note that, in the example above, we have used the {contacts} block to extract the customer's first name for the “thank you” message. Blocks can be displayed in more than one place in a template, but blocks which belong within other blocks must still be contained within those blocks.

Contact and Address Details

Reporting the customer's contact and address details is done in exactly the same way as in the callback template, using the same pair of block instructions:

<!-- BLOCK {contacts} -->Billing Contact:
---------------
{salutation} {f_name} {l_name}
{b_flatno}
{b_street}
...
{b_postcode}
<!-- BLOCK {shipping} -->
----------------
Delivery Address:
----------------
{s_name}
{s_flatno}
{s_street}
...
{s_postcode}
<!-- /BLOCK {shipping} --><!-- /BLOCK {contacts} -->

Contact and address details in the Order Email Template.

Again, the shipping address is contained within its own block to allow us to include or exclude it, because an alternative shipping address may or may not have been provided by the customer.

Displaying the Order Details

Showing the contents of the shopping cart in the order email template is done a little differently than on the website. We no longer need both an editable and uneditable version of the shopping cart, because the order is already complete, so we need less template instructions:

<!-- BLOCK {orders} -->--------------
Order Details:
--------------
<!-- BLOCK {items} -->
({quantity}) {title} [ref:{product_code}] at {unit_price} = {price}
<!-- /BLOCK {items} -->
<!-- /BLOCK {orders}-->

<!-- BLOCK {costs} -->-------------------
<!-- BLOCK {subtotal} -->Sub: £{value}<!-- /BLOCK {subtotal} -->
<!-- BLOCK {shipping} -->Ship.: £{value}<!-- /BLOCK {shipping} -->
<!-- BLOCK {tax_a} -->{tax_a_name}: £{value}<!-- /BLOCK {tax_a} -->
<!-- BLOCK {tax_b} -->{tax_b_name}: £{value}<!-- /BLOCK {tax_b} -->
-------------------
<!-- BLOCK {total} -->TOTAL: £{value}<!-- /BLOCK {total} -->
-------------------<!-- /BLOCK {costs} -->

Displaying the customer's order in the Order Email template.

There are some differences between this and the cart template. We enclose the cart items section in BLOCK {orders}, to allow us to exclude any header message we may be using if the customer has only ordered a subscription, and the order lines themselves are within BLOCK {items}, rather than {cart_items} as used in the Shopping Cart template.

We also need to provide information about subscriptions or downloads the customer may have ordered. The template code used here is identical to the shopping cart template, and so we will not repeat it here.

Below is a summary of all template instructions used in the order email template.

Placeholder Output
IF {merchant} This condition should surround any messages to be sent only to the merchant. Messages intended solely for the customer should be contained within an ELSE condition.
BLOCK {contacts} Used to output the contact and address details of the customer.
BLOCK {shipping} Inside BLOCK {contacts}, displays delivery address details if a delivery address other than the billing address was provided.
{salutation} Inside BLOCK {contacts}, placeholder for the customer's salutation/title.
{f_name} Inside BLOCK {contacts}, placeholder for the customer's first name.
{l_name} Inside BLOCK {contacts}, placeholder for the customer's last name.
{tel} Inside BLOCK {contacts}, placeholder for the customer's telephone number.
{tel_eve} Inside BLOCK {contacts}, placeholder for the customer's alternative telephone number.
{email} Inside BLOCK {contacts}, placeholder for the customer's email address.
{b_flatno} Inside BLOCK {contacts}, placeholder for the billing address flat/apartment number.
{b_street} Inside BLOCK {contacts}, placeholder for the billing street address.
{b_town} Inside BLOCK {contacts}, placeholder for the billing address town.
{b_state} Inside BLOCK {contacts}, placeholder for the billing address state/region.
{b_postcode} Inside BLOCK {contacts}, placeholder for the billing address postcode.
{b_destination} Inside BLOCK {contacts}, placeholder for the billing address country/area.
{s_name} Inside BLOCK {shipping}, placeholder for the recipient's name, if delivering to a different address.
{s_flatno} Inside BLOCK {shipping}, placeholder for the shipping address flat/apartment number.
{s_street} Inside BLOCK {shipping}, placeholder for the shipping street address.
{s_town} Inside BLOCK {shipping}, placeholder for the shipping address town.
{s_state} Inside BLOCK {shipping}, placeholder for the shipping address state/region.
{s_postcode} Inside BLOCK {shipping}, placeholder for the shipping address postcode.
{s_destination} Inside BLOCK {shipping}, placeholder for the shipping address country/area.
IF {testmode} The contents of this condition are displayed if the store was operating in test mode when the order was taken. Should contain a message stating clearly that the order is not valid.
{mail_notify_body} If the merchant email is set to only send notification of a new order, and not the full order details, this placeholder is replaced by a notification message in the merchant email.
{cart_id} The unique dotAdmin order ID for this order.
{trans_id} A unique payment ID from the payment provider.
BLOCK {orders} Used to contain BLOCK {items}. Usually used to include a heading for the list of order lines.
BLOCK {items} Inside BLOCK {orders}, this block repeats to display details of each product ordered.
{product_code} Inside BLOCK {items}, the unique product reference number of this product.
{title} Inside BLOCK {items}, the title/name of this product.
{quantity} Inside BLOCK {items}, the number of units ordered of this product.
{unit_price} Inside BLOCK {items}, the price per-unit of this product.
{price} Inside BLOCK {items}, the total cost of all units ordered.
{u_def_<0 to 9>} Inside BLOCK {items}, displays the value of user defined fields for this product (For example: {u_def_0}, {u_def_1}, etc.).
BLOCK {costs} Acts as a container for the subtotal, shipping cost, tax costs and grand total blocks. Can be used to provide a heading for this collection of information.
BLOCK {subtotal} Inside BLOCK {costs}, used to display the order subtotal (price before shipping and tax).
{value} Inside BLOCK {subtotal}, {shipping}, {tax_a}, {tax_b}, {total}, placeholder for the cost of this stage of the order.
BLOCK {shipping} Inside BLOCK {costs}, used to display the cost of shipping this order.
BLOCK {tax_a} Inside BLOCK {costs}, displays the cost incurred by Tax A, if applicable.
{tax_a_name} Inside BLOCK {tax_a}, the the name of the tax applied by Tax A. Taken from the Shipping Zones settings.
BLOCK {tax_b} Inside BLOCK {costs}, displays the cost incurred by Tax B, if applicable.
{tax_b_name} Inside BLOCK {tax_b}, the the name of the tax applied by Tax B. Taken from the Shipping Zones settings.
BLOCK {total} Inside BLOCK {costs}, displays the final, total payment made.
BLOCK {subs} Contains details of any repeat payment arrangement made with this order.
{number} Inside BLOCK {subs}, shows the number of payments to be taken during this repeat payment agreement.
{price} Inside BLOCK {subs}, shows the cost of each individual payment.
{count} Inside BLOCK {subs}, in conjunction with ‘interval’ shows how often payments will be made (For example: 4 [count] weeks[interval]).
{interval} Inside BLOCK {subs}, in conjunction with ‘count’ shows how often payments will be made (For example: 4[count] weeks[interval]).
{start_date} Inside BLOCK {subs}, shows the date that the first subscription payment will be taken.
BLOCK {tax} Inside BLOCK {subs}, shows any appropriate tax costs associated with each payment.
{tax_amount} Inside BLOCK {tax}, shows the cost of applying this tax.
{tax_name} Inside BLOCK {tax}, shows the name of the tax being applied.
BLOCK {url} Contains information relating to any downloadable products or subscriptions ordered.
IF {download} Inside BLOCK {url}, used to display a message if the user has ordered a downloadable product.
IF {subscription} Inside BLOCK {url}, used to display a message if the user has ordered a site subscription.
{title} Inside BLOCK {url}, the title of the ordered product.
{site_address} Inside BLOCK {url}, the web address of this site (For example: http://www.site.com/).
{path} Inside BLOCK {url}, the ID (filename or url) of the product ordered.
{literal ext} Inside BLOCK {url}, displays any additional values that must be added to a link to a subscription or downloadable. Note that this value must be displayed as a “literal” in this plain-text email template. It was not qualified as literal in the HTML callback template.
{download_ttl} Inside BLOCK {url}, the number of days for which the download link is valid.
{subscription_ttl} Inside BLOCK {url}, displays the expiry date of a site subscription.
BLOCK {new_user} The contents of this block are only displayed if a new user account has been generated for the customer (in order to access a downloadable product or site subscription).
{username} Inside BLOCK {new_user}, the username for the new user account.
{password} Inside BLOCK {new_user}, the password for the new user account.
{site_address} Inside BLOCK {new_user}, the web address of this site (For example: http://www.site.com/).
{company_name} The name of the company. Taken from the Site Configuration.
{address_line_1} The company's address. Taken from the Site Configuration.
{address_line_2} The company's address. Taken from the Site Configuration.
{town} The company's town/city address. Taken from the Site Configuration.
{state} The company's state/region address. Taken from the Site Configuration.
{postcode} The company's postcode. Taken from the Site Configuration.
{tel} The company's telephone contact number. Taken from the Site Configuration.
{fax} The company's fax number. Taken from the Site Configuration.
{e-mail} The company's contact email address. Taken from the Site Configuration.