Order Confirmation HTML Template

Overview

This template is rendered when you tap any of the "send email" buttons from the order editing view on your iPad or iPhone. It is also used to render orders prior to printing when you invoke the "Print" bulk action from the orders page here on the website.

The default template is fairly vanilla HTML without much of an attempt to be pretty, but you are free to go as far as you like in adding additional HTML or CSS styles if you want your emails to be more eye-catching.

A warning about CSS in email

Modern email clients vary greatly in their support for CSS styles in HTML email. CSS styles that work fine in your web browser or in more cutting edge clients like Mac Mail might not work at all in Outlook, for example.

Campaign Monitor publish a very useful chart of what HTML and CSS styles are supported by the different email clients.

Template parameters

order (reference to SalesOrder)

A reference to the sales order that you're trying to render.

lines (collection of SalesOrderLine)

The set of line items that should be included in this email. Note that this might be a subset of the actual lines on this order, e.g. if you're emailing just a manufacturer-specific portion of this order. For that reason, you should always use this top-level lines variable instead of accessing the order.lines collection (which always includes all lines on the order).

user (reference to User)

A reference to the user who wrote this order.

custID (string)

The customer ID that is appropriate for inclusion in this email. If you are using manufacturer-specific customer IDs and this customer has such an ID, then custID will be set to that value. Otherwise, this will be equal to {{ order.customer.id }}. You should always use this for displaying the customer ID in confirmation emails.

company (reference to Manufacturer)

A reference to the manufacturer object that corresponds to your company.

manufacturer (reference to Manufacturer)

If the template is being rendered for the manufacturer-specific part of the order, this is a reference to the manufacturer object for that manufacturer. If the template is being rendered for the entire order, then this is null.

supplier (reference to Manufacturer)

If manufacturer is set (i.e. you're rendering a manufacturer-specific part of the order) then supplier = manufacturer. Otherwise, supplier = company. This is a convenience variable to prevent you needing to test if manufacturer == null when you're trying to communicate to the customer who this order is from.

totals (dictionary)

A two-key dictionary providing totals for the whole order. The provided keys are:

  • amount - the total price of the order as a decimal. You probably want to format this as currency with {{ totals.amount | currencyFmt }}.
  • units - the total number of units on the order as an integer.

hasImages (boolean)

Flag indicating whether or not any of the items on this order have product images (i.e. whether {{ line.item.imageURL }} and {{ line.item.thumbnailURL }} will actually return a valid URL for any of the lines). This is useful for deciding whether or not to include a column in your table of line items for showing image thumbnails.

documentWrappers (boolean)

Flag indicating whether or not the template should render the HTML document wrappers <html>, <head>, and <body>.

onlyToCompany (boolean)

If true, this flag indicates that this order confirmation is being sent to the company only, and not the customer. This can be used to eliminate certain things if your office doesn't need to see them. For example, you might use this to eliminate product images from your emails back to your office if they find their inclusion unnecessary.

Setting the subject of the email&nbsp_place_holder;

You'll notice in the default template that there is a comment at the top that looks like:

Edit the part of this comment between the colon and the --> if you want to customize your subject, but make sure to leave the <!-- Subject: part at the beginning in place otherwise the template renderer won't detect your custom subject and will use a default subject.