Email Notifications

Email Notifications are powerful communication tool, which can accompany almost any stage of RMA processing. By default notifications are sent on these events:

  • RMA receives new Status - if field Email Notification for customer or Email Notification for administrator in newly assigned Status are not empty, their contents is sent to customer or staff respectively.
  • New message from customer arrived - if option Template of Notification Email for RMA Owner contains actual template, notification will be sent to RMA Owner on each customer's message arrived.
  • New message from staff member - if option Template of Notification Email for Customer contains actual template, notification will be sent to RMA requester on each staff message.

Notifications also can be sent using Workflow Rules. They are flexible enough to implement any email flow scheme - read more at section Building Custom Email Flow below.

Templates of RMA Email Notifications also can be fully customized to fit your communication policy: they can be redesigned, enhanced with variables, and even custom blocks.

Email Notifications can be translated into other locales. For that you need to follow these steps:

  • Create a custom template with a desired Locale and translated content (see How to Customize Email Notifications section below).
  • Visit Email Notification Settings section in Configuration and switch to the proper storeview using Store Switcher.
  • Uncheck Use Website checkbox near template, translation for which you need, and set your newly created custom template with translation. Save configuration.
  • You may also need to translate Email Notification for customer and Email Notification for administrator. It can be done in corresponding Statuses also via Store Switcher.

How to Manage/Disable Email Notifications

Our extension divides all notifications into three types, governed by corresponding options at Email Notification Settings section of Configuration Settings. All of these options are store-dependent, so you can have different templates for different storeviews.

  • Notification for customer - governed by Template of Notification Email for Customer option.
  • Notification for staff member - governed by Template of Notification Email for RMA Owner option.
  • Notification, sent by Workflow Rule - regardless of its recipient, all rule-based notifications governed by Template of Rule Notification option.

Each of the option above contains transactional template, which is used for sending notification. If any of them is set to Disable these emails, then entire type of notifications will be suppressed.

You can easily observe email flow by setting option Send blind carbon copy (BCC) of all emails to at the same Email Notification Settings section.
Then a copy of each notification will be sent to one or more (comma-separated) emails.


How to Customize Email Notifications

Our extension comes with default templates of notifications Depending of type of notifications, different approaches required for their customizations.

- Customizing Email Notifications Templates

Each notification, as noted above, belongs to one of three main types, which also have corresponding templates. To customize them, you need to follow these steps:

  • Go to the System -> Transactional Emails, and press Add New Template.
  • In section Load Default Template in Template drop-down list select one of pre-defined RMA templates (it is not mandatory, but makes customization easier):
    • RMA - Notification Email for Customer
    • RMA - Notification Email for RMA Owner
    • RMA - Template of Rule Notifications
  • In the same section select Locale, for which newly created template shall be applied. By default it is English (United States).
  • Then press Load Template button, and template will be loaded to the Template Subject and Template Body fields.
  • Modify Template Subject and Template Content as you need.
  • Give a sensical Template Name to your new template, and save it.
  • Go the to RMA -> Settings -> Email Notification Settings. Select a storeview, if need, at Store Switcher. Then pick up option, corresponding to notification type (say, Template of Notification Email for Customer), which you need to change, and replace its value with your newly created template.
  • Save Configuration.

From that moment notifications will flow using your custom template.

- Customizing Automatic Replies

Automatic Replies are sent to customer, when RMA receives a particular status. It breaks into two parts: message from Notification Email for Customer in particular Status, which is enclosed inside Notification Email for Customer template, defined in Settings. To customize such a messages, you need to do the following:

  • Customize template RMA - Notification Email for Customer, as described in previous section.
  • Go to RMA -> Dictionaries -> Statuses, pick a Status, and add to Email Notification for customer field message, that should be enclosed in template above.
    In some cases you may also need a special conditional automatic reply. Read more about this here.

- Customizing Rule Notifications

Rule Notifications can be sent to customer, staff member, or to specific emails, when Workflow Rule is triggered and some action executed.

They also break into two parts: message, defined at Notifications tab of Workflow Rule, which is enclosed inside Template of Rule Notifications template, defined in Settings. To customize such a messages, you need to do the following:

  • Customize template RMA - Template of Rule Notifications, as described in previous sections.
  • Go to RMA -> Workflow Rules, pick a Rule, and add to Email Subject and Email Body message, that should be enclosed in template above.

- Using Variables in Email Notifications

Any notifications of mentioned above, can be personalized, using Variables. Some of them can be added at Transitional Email Template edit page (see above, in Customizing Email Notifications Templates).

Our extension provides a rich set of additional variables, through which current RMA properties can be included to the notification:

  • Global variables and shortcuts

    • {{var customer}} - object variable, which allows access to customer properties;
    • {{var rma}} - object variable, which allows access to RMA properties, including custom fields (see below).
    • {{var comment}} - contains message, sent to customer or staff in RMA discussion.
    • {{var email_body}} - used in Rule templates,
    • {{var store_name}} - name of current store
    • {{var store_phone}} - phone of current store
    • {{var store_address}} - address of current store
    • {{var user_firstname}} - First Name of current agent
    • {{var user_lastname}} - Last Name of current agent
    • {{var user_email}} - Email of current agent

    If Helpdesk also integrated with RMA, it is possible to use two another variables:

    • {{var hidden_separator}} - allows to separate answer from communication history
    • {{var hidden_code}} - allows to hide ticket code in email template, which is used to bind email with ticket

     

  • Customer Properties

    • {{var customer.getName()}} - Full Name of current customers
    • {{var customer.getEmail()}} - Email of current customer

     

  • RMA Properties

    • {{var rma.getIncrementId()}} - current RMA number
    • {{var rma.getFirstname()}} - first Name of current customer
    • {{var rma.getLastname()}} - last Name of current customer
    • {{var rma.getName()}} - full name of current customer
    • {{var rma.getCode()}} - number of current RMA
    • {{var rma.getStatusName()}} - current status of RMA
    • {{var rma.getUrl()}} - URL of current RMA
    • {{var rma.getBackendUrl()}} - backend URL to RMA page
    • {{var rma.getPrintUrl()}} - URL of printable version of current RMA
    • {{var rma.getUserName()}} - full name of current agent
    • {{var rma.getGuestPrintLabelUrl()}} - URL of Package Slip Label
    • {{var rma.getReturnAddressHtml()}} - address, where package is returned
    • {{var rma.getLastComment()}} - last comment, left in RMA History
    • {{var rma.getStatus().getCustomerMessage()}} - automated message to the customer, sent on assigning current Status.
    • {{var rma.getStatus().getAdminMessage()}} - automated message to the staff member, sent on assigning current Status.

     

Through {{var rma}} variable you can also access properties of original orders.

Order object itself can be obtained using {{var rma.getOrder()}}, and its properties will be accessible via the following expressions:

  • Order Properties

    • {{var rma.getOrder().getIncrementId()}} - number of original order.
    • {{var rma.getOrder().getState()}} - state of original order. It is major state , defined in System -> Order Statuses, in State Code column.
    • {{var rma.getOrder().getStatus()}} - status of original order. It is a minor state, defined in System -> Order Statuses, in Status Code column.
    • {{var rma.getOrder().getCouponCode()}} - coupon code. Returns non-empty value only if Coupon was used. This is in fact boolean value, and can be used in {{depend}} block.
    • {{var rma.getOrder().getShippingDescription()}} - name of Shipping Method, used in original order.
    • {{var rma.getOrder().getDiscountAmount()}} - amount of discount, provided in original order. This is in fact boolean value, and can be used in {{depend}} block.
    • {{var rma.getOrder().getGrandTotal()}} - grand total of original order.
    • {{var rma.getOrder().getTotalOfflineRefunded()}} - refunded amount in Offline mode (e. q. with Credit Memo).
    • {{var rma.getOrder().getTotalOnlineRefunded()}} - refunded amount in Online mode (e. q. using external payment systems).
    • {{var rma.getOrder().getGlobalCurrencyCode()}} - global currency code, used on current store.
    • {{var rma.getOrder().getOrderCurrencyCode()}} - currency, in which order was placed.
    • {{var rma.getOrder().getCustomerIsGuest()}} - whether customer is a Guest. This is in fact boolean value, and can be used in {{depend}} block.
    • {{var rma.getOrder().getCustomerEmail()}} - email, from which original order was placed.
    • {{var rma.getOrder().getCustomerFirstname()}} - first name of customer, which had placed original order (useful for Guest-mode orders and RMA).
    • {{var rma.getOrder().getCustomerLastname()}} - last name of customer, which had placed original order (useful for Guest-mode orders and RMA).
    • {{var rma.getOrder().getRemoteIp()}} - IP-address, from which original order was placed.

     

The same expressions, as above, are applicable, if RMA is placed for multiple orders (it is possible, when option Allow RMA for multiple orders from RMA Policy settings is set to Yes).

In this case accesser expression {{var rma.getOrder()}} will always return first original order. To obtain access to subsequent, you need to replace it to {{var rma.getOrder([INDEX])}}, where [INDEX] is zero-based number or orders.

If you need to have a number of second original order in current RMA, then expression would be: {{var rma.getOrder(1).getIncrementId()}}
Since it's not necessary to have second original order in RMA, see also next example.

When using multiple orders, you may need to divide email into blocks for each order separately (since it's not mandatory to use 2 or 3 orders - there still can be only one original order), you can use {{depend}} sections, as shown below:

{{depend rma.getOrder(1)}}
    [custom display of second order, used in current RMA].
{{/depend}}

The approach is the same, as in Conditional automatic messages in Statuses.

You can access only properties of Magento orders, Offline order properties can not be accessed this way - since in fact they do not exist.

If need, it is possible to use in RMA templates standard custom variables as well. They are created with System -> Custom Variables and can be inserted with {{customvar code="var_name"}}. For example, if custom variable have code "test", then variable will be {{customvar code="test"}}. Read more about these variables here.


Custom Blocks in Notifications

You can also create custom blocks, which can be used in notification.

Generic syntax for such blocks is: {{block type="[BLOCK TYPE]" rma=$rma}}, where [BLOCK TYPE] is type of your custom block, defined in layout.

Parameter rma allows direct access to RMA properties, since this block will be enclosed in RMA Template, and that template contains $rma variable.

Custom block dependable item list, described in Conditional automatic messages in Statuses also can be used in notifications, and can serve as good example.

  • Usage: {{block type="rma/rma_view_items" rma=$rma}}
  • PHP Module: app/code/local/Mirasvit/Rma/Block/Rma/View/Items.php
  • Corresponding Template: app/design/frontend/base/default/template/mst_rma/rma/email/items.phtml

You can also include to the notifications CMS blocks, defined in CMS -> Static Blocks. For that you will need more complex syntax: {{block type="cms/block" block_id="[BLOCK_ID]" template="[PATH_TO_TEMPLATE] rma=$rma"}}.

In this case you also need to register your CMS block at System -> Permission -> Blocks.


Building Custom Email Flow

Sometimes you need to build your own email flow, independent from that comes with our extension out-of-box. Here is some useful advices, how it should be constructed:

  • Plan your Statuses transitions and RMA lifecycle. Whenever status is assigned, it can be accompanied by Email Notification.
  • Use Workflow Rules for creation additional Email Notifications or replace existing ones. Here is a few good examples:

  • New Staff Message Notification - sends notification to customer, when staff member adds a message to communication.

    • Event: New reply from staff
    • Actions:
      • Resolved: Mark as unresolved (we need it in order to trigger Rule)
    • Notifications:
      • Send email to customer: Yes
      • Email subject: You have new message
      • Email body: {{var rma.getLastComment()}}

     

  • New Customer Message Notification - sends notification to RMA owner, when customer adds a message to communication.

    • Event: New reply from customer
    • Actions:
      • Resolved: Mark as unresolved (we need it in order to trigger Rule)
    • Notifications:
      • Send email to RMA owner: Yes
      • Email subject: You have new message
      • Email body: {{var rma.getLastComment()}}

     

  • Transitional Notification - sends notification to customer, whenever particular status is assigned, with its dedicated message.

    • Event: RMA has been changed
    • Conditions:
      • Status is Approved (or other status)
      • Status (before change) is not Approved
    • Actions:
      • Resolved: Mark as unresolved (we need it in order to trigger Rule)
    • Notifications:
      • Send email to customer: Yes
      • Email subject: Your Request was approved
      • Email body: {{var rma.getStatus().getCustomerMessage()}}

    Note: In this case Status auto-reply template shall not contain variables. All personalized content (e. q. name of customer, etc.) shall be entered in Email Body field of the rule.

  • If you wish to suppress all standard notifications, provided by our extension, and replace with your own, based on Rules - you shall not disable Template of Rule Notification option, otherwise your custom notifications won't be sent.
    Suppressing Template of Notification Email for Customer means suppressing not only notifications about messages, but also auto-replies from statuses. You can, however, duplicate them using Transitional Notification example, described in previous advice.
  • Make sure, that conditions does not overlay each other, and each rule is triggered properly.
  • Use Sort Order and Stop Further Rules Processing options in Workflow Rule to control execution of rules, binded to the same event.
RMA