Customize the Order Email

Introduction

Please review the basic shopping online tutorial. This tutorial is an extension of the basic shopping online tutorial and explains how to customize one aspect of the shopping basket system. View the other advanced tutorials to customize other aspects of the shopping basket system.

The default order email displays formatted payment, billing, shipping and order information aligned by colons. If you prefer a different layout or require a specific format for an order processing program, for example, use the mgiSendOrder placeholders and mgiPostArgument tags to customize the order email. Please note that the mgiSendOrder placeholders are not "post-processed" which means that placeholder values cannot be used in math calculations, etc. Those values are simply replaced with the customer's values and order information.

MGI Tags

Steps

  1. Open the order processing page in a text editor.
  2. Customize the order email.
  3. Save the order processing page.
  4. FTP the order processing page to the web server running MGI.
  5. Add items to the shopping basket, check out, confirm and process the order.


Step 1: Open the order processing page in a text editor.

Open the order processing page (e.g., completeorder.mgi) in a text editing program that allows you to view and modify the HTML and code of the page.

Step 2: Customize the order email.

If you prefer a different email format, use the mgiSendOrder placeholders and mgiPostArgument tags to customize the email layout. Placeholders between the "Begin Template" and "End Template" comments will be repeated for each item ordered and replaced with the item's specific information. If you use the mgiCollectUserInfo tag to collect payment, billing, and shipping information, then you can display that information in the custom order email by using the default post arguments. However, if you created a custom form to collect payment, billing and shipping information, then use your post argument names to display that information in the custom order email. Custom order emails are sent as text, therefore you may use spaces to align information.
 
The mgiSendOrder email is not "post-processed" which means that you cannot perform MGI functions such as math calculations with placeholders in the body of the mgiSendOrder tags. If you need to perform such functions with placeholder information, we suggest you perform the function in the mgiConfirmOrder tag and use a hidden post argument to transfer the result to the mgiSendOrder page. The custom order email in this example has the following format:
 
You may format the order email using the following placeholders for item and order total information. The placeholders will be replaced with each product's specific information or total.
  • &mgiDBFieldQuantity; is the quantity of the product.
  • &mgiDBFieldQuantityMultiplier; is the quantity multiplier of the product.
  • &mgiDBFieldProductID; is the product ID.
  • &mgiDBFieldName; is the product name (short description).
  • &mgiDBFieldDescription; is the product description
  • &mgiDBFieldPrice; is the product price.
  • &mgiDBFieldShipping; is the product shipping cost.
  • &mgiDBFieldQualifier1; is the first product qualifier.
  • &mgiDBFieldQualifier2; is the second product qualifier.
  • &mgiDBFieldQualifier3; is the third product qualifier.
  • &mgiDBFieldQualifier4; is the fourth product qualifier.
  • &mgiDBFieldQualifier5; is the fifth product qualifier.
  • &mgiDBFieldWeight; is the product weight.
  • &mgiSBItemPriceTotal; is the price of a product multiplied by the quantity purchased and includes any price rules that have been applied.
  • &mgiSBItemShippingTotal; is the shipping price of a product after shipping rules have been applied.
  • &mgiSBItemTotal; is the total price of a product (price subtotal plus shipping subtotal) after price and shipping rules have been applied.
  • &mgiSBSubtotal; is the price of the order after the price rule(s) have been applied.
  • &mgiSBTax; is the tax on the order after the tax rule(s) have been applied.
  • &mgiSBShippingTotal; is the shipping price of the order after the shipping rule(s) have been applied.
  • &mgiSBTotal; is the total price of the order after all rules have been applied.
 
You may include information using other MGI tags in the custom order email. In this example the token value and current date are displayed in the order email.
 
Customizing the display of the order processing page itself does not require you to customize any other aspect of the shopping basket system. The order processing page may be customized independently of the shopping basket page, check out page, and order confirmation page.
 
The following is the code of a custom order email:
<mgiSendOrder handle="Default"
shoppingBasketURL="http://www.domain.com/" 
to="orders@domain.com" from="webmaster@domain.com" 
mailServer="mail.domain.com"
subject="Test MGI2 SB Order">

Payment
-------
       Type: <mgiPostArgument name="CardType">
     Number: <mgiPostArgument name="CCNumber">
        Exp: <mgiPostArgument name="EXPMO"> 
<mgiPostArgument name="EXPYE">
 
Billing
-------
       Name: <mgiPostArgument name="bName">
    Company: <mgiPostArgument name="bCompany">
    Address: <mgiPostArgument name="bAddress1">
             <mgiPostArgument name="bCity"> 
<mgiPostArgument name="bState"> 
<mgiPostArgument name="bZipCode">
             <mgiPostArgument name="bCountry">
      Phone: <mgiPostArgument name="bPhone">
        Fax: <mgiPostArgument name="bFax">
      Email: <mgiPostArgument name="bEmail">
      
Order
-----
  Order Ref: <mgiPathArgument name="mgiToken">
 Order Date: <mgiDate>
<!-- Begin Template -->

 Product ID: &mgiDBFieldProductID;
        Qty: &mgiDBFieldQuantity;
    Product: &mgiDBFieldName;
 Price Each: $&mgiDBFieldPrice;
 Item Total: $&mgiSBItemPriceTotal;
<!-- End Template -->

        Tax: $&mgiSBTax;
      Total: $&mgiSBTotal;
</mgiSendOrder>

Step 3: Save the order processing page.

Save the changes you have made to the order processing page.

Step 4: FTP the order processing page to the web server running MGI.

Upload the order processing page from your local computer to the web server using an FTP program.

Step 5: Add items to the shopping basket, check out, confirm and process the order.

Add items to your shopping basket, complete the check out page, confirm your order and process the order. The custom order email in this example has the following display:
Payment
-------
       Type: VISA
     Number: 1111222233334444
        Exp: 12 2001
 
Billing
-------
       Name: Samuel Smith
    Company: RedStar
    Address: 1100 Main Street
             Charlotte North Carolina 25849
             United States of America
      Phone: 704-123-4567
        Fax: 704-123-4568
      Email: ssmith@redstar.com
      
Order
-----
  Order Ref: 36Q03NHIB14GT5
 Order Date: Tuesday, August 21, 2001
 
 Product ID: 0-688-16199-5
        Qty: 1
    Product: How to Cook Meat
 Price Each: $28.00
 Item Total: $28.00
 
 Product ID: 0-060-16010-1
        Qty: 1
    Product: The New York Times Cook Book
 Price Each: $26.00
 Item Total: $26.00
 
        Tax: $0.00
      Total: $54.00


[Return to the Shopping Online Menu]


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]