Aurora Email Variables
This article covers the use of variables, functions, includes and place-holders within most Aurora email templates.Using this you should be able to gain a better understanding of how to access and display data from Aurora in your emails, though it should be noted that not all of the fields detailed here are available to all emails.
Introduction
This section aims to introduce you to the different email template systems that are available in Aurora and how they can be used.
There are two basic types of email template:
- The 'Orders' -> 'Emails' templates (AKA: 'Order Emails'), which are managed via the back-end for use with orders and other common account functions.
- The 'Email Templates Files', which are managed by FTP and can typically be found and edited in the 'templates' directory of your FTP account, within the 'emails' directory.
Email Special Fields (Placeholders or Variables)
Both of these email template systems use an identical set of values to populate special text elements referred to as placeholders. These placeholders are used to allow commonly required values to be placed into an email at any point. An example of such a placeholder is '{$username}', which would be replaced with the full User Name of the recipient of the email when it is being sent. For example:
Dear {$firstname},
Your order will be with you shortly.
Kind Regards.
Would be received by the customer as...
Dear Tom,
Your order will be with you shortly.
King Regards.
Placeholder Types
There are two 'types' of placeholder, String and Array.
The two types are treated in very different ways. A string placeholder is simply replaced with some value, whether that be a name, price or some other value. It simply marks the place a value will appear.
An array placeholder is different in that it does not get replaced with a single value, but instead is a container for many other values. A typical example of this is the '$basket' placeholder, which holds a set of placeholders for each line of an order's basket. These placeholders can be cycled through using the construct shown below...
{foreach from=$basket item="basket\_line"}
Product ID is {$basket\_line.product\_id}
{/foreach}
Note the use of the '.' to mark the end of the placeholder container and the beginning of the one you are requesting.
Globally Available Placeholders
Below is a list of available placeholders that can be used in the email templates.
Placeholder | Type | Currency | Value |
$username | String | The customer's registered user name | |
$email_address | String | The customer's registered e-mail address | |
$password | String | The customer's registered password | |
$title | String | The customer's registered title (e.g. Mr/Mrs/Ms/etc) | |
$firstname | String | The customer's registered first name | |
$lastname | String | The customer's registered last name | |
$tracking_url | String | A link to the courier's website with the tracking number for the related customer order, if relevant | |
$tracking_number | String | The tracking number for the related customer order, if relevant | |
$resetpassword | String | A link to the 'Reset Password' feature this the customer | |
$order_id | Integer | The order ID for the related order, if relevant | |
$returns_reference | String | The returns reference number for the related customer order, if relevant | |
$refund_amount | String | Default | The refund amount due/paid for the related customer order, if relevant |
$order | Array | All values stored against the related customer order | |
$order.id | Integer | The Internal ID Aurora uses to identify an Order (if relevant). | |
$order.date_created | Integer (Timestamp) | The time the order was first created/placed. | |
$order.date_shipped | Integer (Timestamp) | The time the order was marked as shipped in Aurora. This value is not always set for all orders, depending on your store's individual configuration and the source of the Order (e.g. third party orders may behave differently). | |
$order.store_id | Integer | The Internal ID Aurora uses to identify a Store Location. | |
$order.user_id | Integer | The Internal ID Aurora uses to identify a User/Customer account. | |
$order.payment_type | String | The type of payment taken, i.e. Card, eBay, Amazon, etc... | |
$order.tracking_number | Integer | ||
$order.exchange_rate | Integer | This is the exchange rate set in Aurora at the time the purchase was made. This is not the exchange rate that was actually charged to the customer in the event exchange was necessary during payment processing. This is only the exchange rate used to convert the prices for display on the Front-end. | |
$order.order_total | Integer | Default | The total value of the order, not including shipping. |
$order.shipping_cost | Integer | Default | The shipping cost excluding tax. |
$order.shipping_tax | Integer | Default | The tax attributed to the shipping cost. To display how much was charged in total for shipping, simply add the "shipping_cost" and "shipping_tax" values together. |
$order.order_tax | Integer | Default | The tax attributed to the ordered items. |
$order.coupon_discount | Integer | Default | The amount of discount issued due to Coupons. |
$order.order_discount | Integer | Default | The amount of discount issued due to certain promotional discounts. |
$order.total_discount | Integer | Default | The total discount applicable to the order. |
$order.loyalty_points_earned | Integer | The number of Loyalty Points earnt as a result of this Order. | |
$order.additional_fields | Array | All order additional fields. Key = field name, Value = field value | |
$order.items | Array | Container for ordered items data. | |
$order.items.additional_fields | Array | All ordered items additional fields. Key = Ordered Item id, Value = Array, where Key = field name, Value = field value | |
$language_iso | String | ||
$delivery_estimate | String | The estimated delivery date for the related customer order | |
$delivery_method | String | The delivery method used for the related customer order | |
$total_cost | String | The total cost in the currency of the related customer order | |
$card_cost | String | The amount charged to cards in the currency of the related customer order | |
$card_number | String | The last 4 digits of the payment card (if available). Not all payment methods may have this set where they may not available. | |
$card_cost_in_pounds | String | The amount charged to cards in GBP for the related customer order | |
$payment_transactions | Array [ $transaction ] | An array of all successful payment transactions for the current order, as described by the '$transaction' array. Please refer to the Order Transaction Variables article for further details regarding the variables available in the $transaction Container. | |
$refund_transactions | Array [ $transaction ] | An array of all successful payment transactions for the current order, as described by the '$transaction' array. Please refer to the Order Transaction Variables article for further details regarding the variables available in the $transaction Container. | |
$invoice_address | Array | All address details provided for invoicing for the related customer order | |
$delivery_address | Array | All address details provided for delivery for the related customer order (when the customer opts to receive their order to a specified address) | |
$store_info | Array | All store details available for the related customer order, if relevant (when the customer opts to have their order delivered to a store location) | |
$collect_plus | String | Confirm if it was a Collect+ order | |
$order_transaction | Array | All details pertaining to the payment transaction made for the related customer order | |
$order_notes | Array | All details pertaining to the last (most recent) order note for the related customer order | |
$config | Array | All values from the back-end configuration, allowing customisation or emails according to settings configured in the 'Store' -> 'Settings' section | |
$currency_id | String | The ID of the currency used for the related customer order | |
$currency | Array | All details pertaining to the currency used for the related customer order | |
$currency_conversion | String | The exchange rate used to convert the monetary values from GBP to the currency used for the related customer order | |
$cross_sells | Array | All 'Cross Sell' products for the related customer order | |
$shipping_cost | String | The shipping cost in the currency of the related customer order | |
$shipping_tax | String | The tax on the shipping | |
$order_tax | String | The tax on the purchased items. Combined $shipping_tax+$order_tax for the total tax | |
$default_tax_rate | String | The default tax rate for the site, e.g. "20" if your tax rate is 20% | |
$payment_cost | String | The payment actually taken from the customer in the currency of the related customer order | |
$discount | String | The total discount applied in the currency of the related customer order | |
$coupon_discount | String | The discounts applied as a result of coupons alone in the currency of the related customer order | |
$applied_loyalty_points | String | The number of loyalty points used on the related customer order | |
$basket_loyalty_points | String | The number of loyalty points earned on the related customer order | |
$basket_loyalty_points | String | The total number of loyalty points the customer currently has | |
$contact_info | Array | Information sent through in a contact form | |
$failed_items | Array | The basket of a failed order | |
$returned_items | Array | The list of returned items, if this is an email regarding a return. | |
$http_host | String | To be used to reference the master domain. This should be used instead of $smarty.server.HTTP_HOST as it will continue to work from the CLI. | |
$refunded_items | Array | The list of refunded items, if this is an email regarding a refund. | |
$refunded_items.x.product_price | Float | Price the product was refunded at. | |
$refunded_items.x.product_quantity | Integer | Quantity of products refunded. | |
$refunded_items.x.product | Array | Full details of the refunded product. | |
$user | Array | A Container holding all of the User Data. | |
$user.firstname | String | The customer's registered first name | |
$user.lastname | String | The customer's registered last name | |
$user.company | String | The customer's registered company name | |
$user.email_address | String | The customer's registered email address | |
$uri_to_confirm_email | String | The relative URL to allow a user to verify their email address. This variable is only present when a user record can be located for the email. | |
$user_email_verified | Boolean | TRUE if the user's current email address has been verified, otherwise FALSE. | |
$basket | Array | All dispatched lines (or lines that have no status at all) of the basket for the related customer order | |
$basket.x.product | Array | Please refer to the Product Details section. | |
$all_ordered_items | Array | All lines of the basket (regardless of status) for the related customer order | |
$all_ordered_items.x.product | Array | Please refer to the Product Details section. |
Updating Order Part Dispatch Status Placeholders
Placeholder | Type | Currency | Value |
$part_order_despatch_used | Boolean | TRUE if part despatch is used for this order. | |
$part_order_despatch | html text | Most Recently shipped part dispatch items rendered using the template "emails/basket.tpl.html" into this variable. Available as $basket variable within this template render. | |
$not_despatched | html text | All ordered items from part despatches that have not yet been shipped rendered using the template "emails/basket.tpl.html" into this variable. Available as $basket variable within this template render. |
Updating Order Item Status Placeholders
Placeholder | Type | Currency | Value |
$updated_items | Array | All updated items within an order | |
$updated_items.x.item | Array | Item details and includes product information | |
$updated_items.x.item.product_price | String | Price of item that has been updated, this is the individual price. | |
$updated_items.x.item.product_quantity | String | Quantity of item that has been updated | |
$updated_items.x.item.product_discount | String | Total discount of all related items. | |
$updated_items.x.item.product | Array | Please refer to the Product Details section. |
Email Verification and Notification Specific Placeholders
Placeholder | Type | Currency | Value |
$new_email_adderss | String | The email address the user account is now using or requesting to be used. |
Review Specific Placeholders
This system used to make use of the "emails/satisfaction-items.tpl.html" template, but this behaviour has now been deprecated.
This old method and the new one described below cannot be used alongside one-another and if the template described above is found, then Aurora will prevent you from using the new method. This being so, please be sure to check you do not have this file in your Front-end Templates before proceeding and remove it if you do.
Placeholder | Type | Currency | Value |
$reviewed_ordered_items | Array | The basket of a completed order, when you are requesting feedback for a review. |
Including other templates
Other templates can be included within the Email. This allows you to share content between emails or include large amounts of HTML or text.
Templates are included with the include function e.g.
{include file="includes_folder/my_email_include.tpl.html"}
The template include path is from your front end templates directory for that site e.g. templates/example.com/. In the example above the includes_folder would be located at templates/example.com/includes_folder
Example Review Request Email Template
For more general information regarding how to manage Review Reminder Emails and where to use the below template content, please see the Review Reminder Emails Support Article
The content in this email should be something like the following, in order to display your particular message and product links.
<p style="margin: 15px 0;">Hi there, we are just getting in touch to see if you liked your experience!</p>
<p style="margin: 15px 0;">
{foreach from=$reviewed_ordered_items item=order_item}
Review your product: <a href="http://{$http_host}/products/reviews/write/{$order_item.product_id}">{$order_item.product_name}</a><br />
{/foreach}
</p>
Updated 10 months ago