The Notifications module supports notification infrastructure and consists of the following:
- Notification list
- Notification templates layouts
- Notification activity feed
- Email templates with Scriban (Liquid support enabled)
- Extendable model
- Support for SMTP and SendGrid
- Async delivery with retry policy
The Notification List section of the Notifications module contains all types of notifications and notification templates registered by running modules.
The following modules from the commerce bundle declare notifications by default:
- Customer module
- Orders module
- Subscription module
There are two basic types of notifications supported:
- Email notifications
- Text message (SMS) notifications
These notification types are provided by VC settings out-of-the-box. The system also allows you to register new notification types coming from third party modules integrated with Virto Commerce.
- Open the Notifications module, navigate to Notifications list and select a notification with the email type.
- The system will display the Notification details screen with the following elements:
- The Active enables or disables the selected notification.
- The Notification name field is a label and cannot be edited.
- The CC recipient field has a default value, although you can enter an additional email addresses.
- The BCC field is blank by default. You can enter as many emails as you need.
Every notification can have one or more templates to render the notification in different languages.
Scriban/Liquid syntax is used to describe email templates. As Scriban library is leveraged to render notifications, you can write both Liquid and Scriban templates. For more information on Liquid syntax, go here.
On the Notifications details screen, select the Templates widget, and then select the template from the list on the Manage notification templates screen:
On the Template details screen, you can:
- Select language for your template.
- Select layout for your template (if applicable).
- Edit email subject.
- Edit template for the email body.
- Edit the sample data JSON file (scroll the screen to the bottom):
- Click OK to save the template or Cancel to discard your changes.
Most of the notifications have predefined templates and sample data. You can use them as a base for your custom template. Predefined templates are shipped within notification hosting modules.
To revert your notification template and sample data to the predefined state, click the Restore button:
To preview the rendered email, click the Preview button on the top of the screen. The template will be rendered with the object described in the sample data JSON file, and the result will be shown in a separate screen:
The preview screen shows the sample of the email body. All styles in the preview screen are in the default state and you can see the sample on the as is basis. Unfortunately, different email clients show HTML markups in a slightly different way and not exactly as it is in the browser with the default styles.
We encourage you to refer to our template construction tips to understand the basics of template development and avoid typical problems with email client differences.
You can send the preview to someone to ensure the body looks well in your email client software using the Share button:
Enter the email address in question and click Confirm.
Template layout is a common part of the notification template subset. It may come in handy to extract common parts of the notification body into a separate document to simplify the editing process of common notification parts, such as footer, header, etc.
The layout feature is implemented with the Scriban capture statement.
Let's take a close look to the example to understand how it works:
- In the Notifications menu, select Notification layouts and add a new layout. The layout body is a template that will be populated together with notification template on email body rendering. Define a special variable within the body, for example, content, and place it between header and footer, e.g.:
<div>HEADER</div>
{{ content }}
<div>FOOTER</div>
The {{ content }}
statement inserts a part of the notification template with the content
name into the resulting document.
We are assuming here that the content
variable contains the result of rendering a named part of the notification template.
- To use this layout, open the email template. Select the created layout in the dropdown list and provide the template code for the
content
variable. You should do it with thecapture
statement, e.g.:
{% capture content %}
Renders the content by captured <strong>content</strong> keyword. <br />
Can use template variables: <strong>{{ customer_order.number }}</strong>
{% endcapture %}
- As usual, you can check whether your email notification is correct by clicking the Preview button:
As you can see on the sample image, the template was rendered with the use of layout.
!!! note You can have as many variables in a layout as you want; they will be captured from the notification template.
Obviously, the same layout with the variable values varying from template to template helps you manage common notification body parts easily.
- <ake sure to save changes in the notification template.
Virto's Notifications module saves notification activity logs and stores them under the Notification log.
To view the logs, select the notification, open Notification details and select the Send log widget.
The system will display the existing logs on the Notification sending logs screen:
Thissection of the Notifications module displays the list of all notification recorders created within the system by the business modules.
To view the notification details, select the notification in question, and the system will display the notification info on a separate screen: