To add a new email template, click on the button of the same name.
Let's take a look at some of the fields that need to be filled in:
From. The field can contain both the address itself, for example, info@site.uk
, or an extended entry of the form: Jack Daniels <info@site.uk>
.
Where to use. Determines where the template will be available and what objects will be available in it.
To. The email address where the created email will be sent. You can specify both the actual address (demo@demo.uk) and a variable that will substitute the address, for example, from the order - {{ order.anyEmail }}
.
Note
In the "To" field, you can specify several recipient addresses. Addresses are separated by commas, for example: demo@demo.uk,
{{ order.anyEmail }}
. If several recipients are specified in the template, then the emails will be displayed for each recipient separately.
Subject. The subject is specified as plain text or as a twig-template. For example: "New order on the site {{ order.site.url }}
". All available objects can be viewed in the corresponding reference.
Text template. Set as text using HTML and Twig.
Example of writing a text template in HTML:
<p>Dear {{ order.nickName }}, </p>
<p>Your order № {{ order.number }} has been confirmed. The request was received for processing at the warehouse.</p>
<p>You can sleep in peace :) We will inform you about the status of the order. If you want to change the delivery date or time, please email us or call {{order.site.phones|international_phone}}.</p>
<p>When contacting the operator of the online store, do not forget to give your order number</p>
Don't forget to specify an unsubscribe link. An example of using the tag: <unsubscribe>Unsubscribe from the mailing</unsubscribe>
To debug the email use the instructions below:
- When creating and editing an email template, where a list of products is displayed through the cycle
for
- you cannot edit the template when the visual editor is enabled. - When displaying the date, be it the delivery date
order.deliveryDate
or the order creation dateorder.createdAt
- in all cases the date filter|date("d.m.Y")
is mandatory.
That is, the delivery date parameter will look like this: order.deliveryDate|date("d.m.Y")
, and the order creation parameter will look like this: order.createdAt|date("d.m.Y")
.
Checking that the template is displayed correctly can be carried out using the following steps:
- Go to the page for editing the email template.
- Copy the source code of the template.
- Go to the order (you can use a test order in which all or most of the fields are filled in), go down to the "Communications" block and click the "New email" button.
- In the window that opens, paste our copied source code.
- Click the "Preview" button.
When editing, you can attach the file to the email template.
Be sure to specify the extension for the attached file. Otherwise, an error will occur when saving.