Skip to main content

How to use variables in the email notification

Email templates can contain special variables, which allow a high level of customization.

RMA supports standard Magento Email template variables, such as {{var logo_alt}}, and supports function calling, like {{var store.getFrontendName()}}. Additionally, it adds a set of its own variables.

  • {{var customer}} - allows access to customer properties.
  • {{var rma}} - allows access to RMA properties, including custom fields.
  • {{var getReply()}} - contains a message sent to a customer or staff in the RMA discussion.
  • {{var email_body}} - contains a customized message from the module helper.

Access to properties is similar to JavaScript, using the dot (.) operator. For example, if you need to include a customer's name in the notification, you can write {{var customer.name}}. If the RMA contains custom fields, they can be accessed by their codes, which are found at Sales -> RMA -> Custom Fields -> Custom Field edit page -> Code. For example, if a custom field has the code customdate, the variable will be {{var rma.customdate}}.

The most commonly used properties are:

  • {{var store.getName()}} - the name of the current store.
  • {{var store.getCode()}} - the code of the current store (e.g., admin for backend, or default for the default store).
  • {{var user.getFirstname()}} - the first name of the current agent.
  • {{var user.getLastname()}} - the last name of the current agent.
  • {{var user.getName()}} - the full name of the current agent.
  • {{var user.getEmail()}} - the email of the current agent.
  • {{var rma.getIncrementId()}} - the current RMA number.
  • {{var rma.getGuestId()}} - displays the guest ID of the current RMA.
  • {{var rma.getUrl()}} - the URL of the current RMA.
  • {{var rma.getBackendUrl()}} - the backend URL to the RMA page.
  • {{var rma.getGuestPrintUrl()}} - the URL of the printable version of the current RMA.
  • {{var status.getName()}} - the current status of the RMA.
  • {{var customer.getName()}} - the full name of the current customer.
  • {{var customer.getEmail()}} - the email of the current customer.
  • {{var rma.getReturnAddressHtml()}} - the address where the package is returned.

There are a number of variables that allow you to use your store information as set in Stores -> Configuration -> General -> Store Information:

  • {{var storeInfo.getName()}} - the name of your store.
  • {{var storeInfo.getPhone()}} - the phone number of the current store.
  • {{var storeInfo.getCountry()}} - the country where your store is located.
  • {{var storeInfo.getCity()}} - the city where your store is located.
  • {{var storeInfo.getRegion()}} - the region where your store is located (if applicable).
  • {{var storeInfo.getPostcode()}} - the postal code of your location.

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

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

You can also use special variables to check whether a particular RMA has items with appropriate Reasons, Conditions, and Resolutions. These special variables can be used to create complex notifications with sections dependent on item properties. For more detailed information, refer to this section of our documentation:

  • {{var rma_getHasItemsWithReason_XXX}} - checks whether the RMA has items with a Reason that has ID=XXX.
  • {{var rma_getHasItemsWithCondition_XXX}} - checks whether the RMA has items with a Condition that has ID=XXX.
  • {{var rma_getHasItemsWithResolution_XXX}} - checks whether the RMA has items with a Resolution that has ID=XXX.

If necessary, it is possible to use RMA templates' standard custom variables. These variables are created in System -> Custom Variables and can be inserted with {{customvar code="var_name"}}. For example, if the custom variable has the code test, then the variable will be {{customvar code="test"}}.