Tokens for the Subject/Title of the email

%order_id%
%order_total%
%order_total_f%
%order_bill_fname%
%order_bill_lname%
%order_ship_fname%
%order_ship_lname%
%order_bill_email%
%order_ship_email%
%order_shipping_total_f% (Merchant 5.x - legacy template only)

Tokens for the From header of the email

%order_bill_email%
%order_ship_email%

Tokens and scripts for the Body of the email

%order_id%
%order_total%
%order_total_f%
%order_date%
%order_time%
%order_date_yyyymmdd%
%order_date_yyyy%
%order_date_mm%
%order_date_dd%
%order_time_hh%
%order_time_mm%
%order_time_ss%
%order_ship_fname%
%order_ship_lname%
%order_ship_email%
%order_ship_phone%
%order_ship_address%
%order_ship_city%
%order_ship_state%
%order_ship_zip%
%order_ship_company%
%order_bill_fname%
%order_bill_lname%
%order_bill_email%
%order_bill_phone%
%order_bill_address%
%order_bill_city%
%order_bill_state%
%order_bill_zip%
%order_bill_company%
%ship_country%
%bill_country%
%ship_country_long%
%bill_country_long%
%ship_block% (full address formatted per each country's postal regulations)
%bill_block% (full address formatted per each country's postal regulations)

%list_products%
%product_code%
%product_name%
%product_quantity%
%product_price%
%product_price_f%
%product_extended_price%
%product_extended_price_f%
%product_descrip%
%product_weight% (Merchant 5.x)
%product_thumbnail% (Merchant 5.x - see below if using 4.x)
%product_image% (Merchant 5.x - see below if using 4.x)
%product_price_sum% (Merchant 4.14 and newer - product base + attribute prices)
%product_extended_price_sum% (Merchant 4.14 and newer - product base + attribute prices X quantity)
%product_price_sum_f% (Merchant 4.14 and newer - formatted product base + attribute prices)
%product_extended_price_sum_f% (Merchant 4.14 and newer - formatted product base + attribute prices X quantity)

%list_attributes%
%option_desc%
%attr_prompt% %opt_prompt% (Merchant 5.x legacy template layout)
%option_price%
%option_price_f%
%option_extended_price%
%option_extended_price_f%

%list_other%
%other_charge_desc%
%other_charge_price%
%other_charge_price_f%

%list_shipping%
%shipping_charge_desc%
%shipping_charge_price%
%shipping_charge_price_f%

%list_tax%
%tax_charge_desc%
%tax_charge_price%
%tax_charge_price_f%

%payment_module%
%payment_data%

%order_products_subtotal_f% (Merchant 5.x legacy template layout in main body section)



Use of the "ifvar" script: The script contains three sections. The ifvar command is the first section. ifvar is case sensitive. The second section contains the variable which must exist and have value in order for the third section to echo output to the screen. The third section is a string with a replacement token for the variable which is evaluated in section two. This replacement token is surrounded with the * character. If the variable value is nil, none of the string will appear. Here are three examples using the "ifvar" script. The first two evaluate the value in an open database set to the current record. The third script evaluates the value of a global variable which is created earlier in the main merchant.mvc program as it runs.

%ifvar|Customers.d.login|Please use this Customer ID on future visits: *Customers.d.login*%
%ifvar|AffiliateSession.d.affil_code|Affiliate: *AffiliateSession.d.affil_code*%
%ifvar|taxexempt|Tax exempt: *taxexempt*%

or in Merchant 5.x
%ifvar|customer_login|Customer Login: *customer_login*%
%ifvar|AffiliateSession:affil_code|Affiliate: *AffiliateSession:affil_code*%


Use of the "var" token: If you know a specific variable exists at runtime, you can display the value of that variable. If the value is nil, there will be no visible output to the screen for that variable.

%var|taxexempt%



Use of the "timeset" token: You can change the time zone that will be used for certain tokens in the body of the email. The value can be plus or minus to offset from the time the server is using. If you do not use this token, the mail will include the date and time reported by the server. The tokens this timeset token effects are: %order_date_yyyymmdd%, %order_date_yyyy%, %order_date_mm%, %order_date_dd%, %order_time_hh%, %order_time_mm%, %order_time_ss%

%timeset|-5%



Use of module related tokens: If the third party module contains the function "TemplatePages_Token" and has a return value for the CIM_TOKENS, you can insert that return value directly into the email template. An example function in the Addendum module looks like:

<MvFUNCTION NAME="TemplatePages_Token" PARAMETERS="module,pos" STANDARDOUTPUTLEVEL="">
 <MvIF EXPR = "{(l.module EQ 'CIM_TOKENS') AND (l.pos EQ '2')}">
  <MvASSIGN NAME = "l.showresponses" VALUE = "{Display_Responses_H('off')}">
 </MvIF>
 <MvFUNCTIONRETURN VALUE = "{l.showresponses}">
</MvFUNCTION>

That function can be called from the Mail Manager template using the token:

%module|addendum|2%



Use of custom customer and product fields: If you have Mail Manager version 5.034 or newer, you can insert tokens to display the custom customer and product fields in the legacy template layout order emails. The customer fields can be displayed in the main body and the product fields in the product section. The custom fields need to be created with the built-in custom fields module that Miva Corp supplies with Miva Merchant. The custom customer fields are only used if the customer creates an account. So if your store has optional account creation, those fields may not be displayed.

Example of customer field in the main body section:
%custom:addr2%

Example of product field in the product section:
%custom:author%


Tokens and scripts for the Products Section of the email

Similar to the tokens and scripts in the body, you can use them in the products section. Below are some examples for Merchant 4.x.
%ifvar|Products.d.image|<img src="*Products.d.image*" border=0><BR>%
%ifvar|Products.d.thumbnail|<img src="*Products.d.thumbnail*" border=0><BR>%
%ifvar|OrderItems.d.upsold|(special)%


Limited Tokens for the Main Section of the email in Merchant 4.14-4.24

If your shipping and payment modules are configured with an invoice message, you can display it with:
%payment_invoice_notice%
%shipping_invoice_notice%

We have included the configurable message in our PayPal and Purchase Order Plus payment modules. We have also included the capability in our Minimum or Subtotal Shipping by ZIP Code Zone. We will be adding it to other shipping modules as time permits.


Require a specific variable to allow the email to be sent

If you want to check for the existance of a variable before sending the email, you can use the "require" token in the main body of the template layout email:
%require|question2%

This would require that the customer checked a box or selected an option so that question2 would have a value or the email would not be sent. Put the require token at the beginning of the main mail body in the template layout section. This does not work with vertical or horizontal layouts.

You can have a value parameter in this token. If you create a require token in the format
%require|question2~xyz%
the value of the variable question2 would need to be xyz. If it is not, the email would not be sent.




Note: All tokens and script commands are case sensitive. Always test the emails by limiting the product codes to a test product not seen by the public until you are sure that the email is operating properly. If you have a failure and the test order does not show up in order processing, be sure to delete all baskets and pack the store databases. Do not recover unused order numbers.

* tokens require Mail Manager version 4.53 or newer and are used in the template layout