The mgiSendOrder Tag

Tag Behavior

Use the mgiSendOrder tag to send an email or create a text file containing the visitor's shopping basket order.


Tag Syntax

The mgiSendOrder tag has a beginning tag with five required parameters and thirteen optional parameters, a body, and an ending tag. The tag form is:

<mgiSendOrder handle="Configuration Name" 
shoppingBasketURL="URL" priceRule="Price Rule Name" 
shippingRule="Shipping Rule Name" taxRule="Tax Rule Name" 
customerLocation="Location List" to="Email Address" 
from="Email Address" cc="Email Address" bcc="Email Address"
replyTo="Email Address" Subject="Title" mailServer="SMTP Server"
attachmentData="Data" attachmentFileLocation="File Path" 
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Customer Info

<!-- Begin Template -->

Repeating Product Template

<!-- End Template -->

Order Totals

</mgiSendOrder>

Required Parameters:

  • handle - The handle is the name of the shopping basket configuration to use. Shopping basket configurations are defined using the admin mode of the mgiShoppingBasket tag.
  • shoppingBasketURL - The shoppingBasketURL is the absolute address to the folder region containing the visitor's shopping basket (i.e., the region containing the mgiShoppingBasket tag that created the visitor's shopping basket).
  • to - The to parameter is the email recipient's email address or a comma delimited list of email addresses for multiple recipients. Multiple "to" parameters may also be included in one mgiSendOrder tag.
  • from - The from parameter is the sender's email address.
  • mailServer - The mailServer is the outgoing SMTP server that is used to send the email. A global outgoing mail server can be enabled by default or always in the region preferences for your domain. If you do not have access to the region preferences for your domain, contact the server administrator. If a global mail server is enabled as "always", then the mail server preference always overrides the mailServer parameter in your region.

Optional Parameters:

  • priceRule - The priceRule is the name of the price algorithm to apply to products in the final shopping basket. Price rules included in the mgiSendOrder tag must have a scope of "basket" in order to be applied to all products that are purchased. Price rules are defined in the admin mode of the mgiShoppingBasket tag.
  • shippingRule - The shippingRule rule is the name of the shipping algorithm to apply to products in the final shopping basket. Shipping rules included in the mgiSendOrder tag must have a scope of "basket" in order to be applied to all products that are purchased. Shipping rules are defined in the admin mode of the mgiShoppingBasket tag.
  • taxRule - The taxRule is the name of the tax algorithm to apply to products in the final shopping basket. Tax rules included in the mgiSendOrder tag must have a scope of "basket" in order to be applied to all products that are purchased. Tax rules are defined in the admin mode of the mgiShoppingBasket tag.
  • customerLocation - The customerLocation is a comma delimited list of the customer's location that is used to determine the customer's tax according to the tax rule. If there is a chain of tax rules, the first location in the list should correspond to the first tax rule, the second location in the list should correspond to the second tax rule, etc.
  • cc - The cc parameter is the email address or comma delimited list of email addresses for multiple carbon copy recipients. Multiple "cc" parameters may also be included in one mgiSendOrder tag.
  • bcc - The bcc parameter is the email address or comma delimited list of email addresses for multiple blind carbon copy recipents. Blind carbon copy addresses do not appear in the email header. Multiple "bcc" parameters may also be included in one mgiSendOrder tag.
  • subject - The subject is the title of the email. The default subject is blank.
  • replyTo - The replyTo parameter is the email addresses where recipient email replies are sent.
  • attachmentData - The attachmentData is a byte stream of data that is sent as an attachment to the email. Multiple "attachmentData" parameters can be included in one mgiSendOrder tag.
  • attachmentFileLocation - The attachmentFileLocation is the relative path to the file that is attached to the email. Multiple "attachmentFileLocation" parameters can be included in one mgiSendOrder tag.
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, shopping basket information will be retrieved from the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.


Technical Notes

  • Price, Shipping and Tax Rules - Price, shipping and tax rules can be configured in the admin mode of mgiShoppingBasket.
    • Shopping basket rules are shared across all shopping basket handles within a region.
    • Only "basket" type rules may be applied in the mgiShoppingBasket tag. Apply "item" type rules in the mgiBuyMe tag.
  • Custom Shopping Basket Display - The body of the mgiSendOrder tag contains a template display that is repeated for each product in the order. If the body of the mgiSendOrder tag is left empty, the default template will be used. To create a custom order format, use HTML, MGI, text , and the following placeholders between the "Begin Template" marker and the "End Template" marker in the body of the mgiSendOrder tag. Information that does not repeat for each product should be placed outside the "Begin Template" marker and the "End Template" marker. The placeholders will be replaced with each product's specific information.
    • &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.
  • Default Payment, Billing and Shipping Post Arguments - 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 following post argument names with the mgiPostArgument tag.
    • PaymentMethod - Shopping basket payment method. Values include "Credit Card", "Purchase Order", and "Check".
    • CardType - Credit card type. Values include "Visa", "Mastercard", "Disover/Novus", "American Express", "Carte Blanche", "Diner's Club", "Bankcard", and/or "JCB" depending on shopping basket configuration.
    • CCNumber - Credit card number.
    • ExpMo - Credit card expiration month.
    • ExpYe - Credit card expiration year.
    • CCName - Name that appears on credit card.
    • PONumber - Purchase order number.
    • POCompany - Purchase order company.
    • BName - Billing name
    • BCompany - Billing company
    • BAddress1 - Billing address
    • BCity - Billing city
    • BState - Billing state
    • BProvince - Billing province
    • BZipCode - Billing zip code
    • BCountry - Billing country
    • BPhone - Billing phone
    • BFax - Billing fax
    • BEmail - Billing email
    • SCompany - Shipping company
    • SAddress1 - Shipping address
    • SCity - Shipping city
    • SState - Shipping state
    • SProvince - Shipping province
    • SZipCode - Shipping zip code
    • SCountry - Shipping country
    • SPhone - Shipping phone
    • SFax - Shipping fax
    • SEmail - Shipping email


Example Usage and Output

Default Order Email

<mgiSendOrder handle="Books" 
shoppingBasketURL="http://www.domain.com/"
to="orders@domain.com" from="onlineorder@domain.com" 
subject="Online Order" mailServer="mail.domain.com">
</mgiSendOrder>

In this example, the mgiSendOrder tag will email an order in the default format to orders@domain.com with the subject "Online Order". The default order email contains the payment, billing, shipping, and order information in this format:

Payment Information
-------------------
 Payment Method:  Credit Card
           Type:  VISA
         Number:  1111222233334444
Expiration Date:  12/2001
           Name:  Samuel Smith

Billing Information
-------------------
           Name:  Samuel Smith
        Company:  RedStar
        Address:  1100 Main Street
           City:  Charlotte
          State:  North Carolina
       Zip Code:  25849
        Country:  United States of America
          Phone:  704-123-4567
            Fax:  704-123-4568
          Email:  ssmith@redstar.com

Product Information
--------------------
       Quantity:  1
     Product ID:  0-688-16199-5
           Name:  How to Cook Meat
    Total Price:  $28.00
 
       Quantity:  1
     Product ID:  0-060-16010-1
           Name:  The New York Times Cook Book
    Total Price:  $26.00
 
       Subtotal:  $54.00
            Tax:  $0.00
       Shipping:  $0.00
          Total:  $54.00

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>

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 specific post arguments (listed above under Technical Notes). 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:

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


Suggested Usage

  • Shopping Basket


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


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