web design and hosting
features and pricing my account customer support about ICG Link, Inc. contact ICG Link, Inc.

NetMerchant Mail and File Format Templates
   
 
 
NetMerchant Mail and File Format Templates

Netmerchant uses simple text files to establish how e-mail messages will look and how data written to files will look. You can use the setup tool to copy the default mail and file format template files to your www/data/shopname folder. In order to create a working version of your shop you will want to FTP these files to yourself and edit them as shown below.

Mail Template

For the purposes of these instructions, we have used the mail template file name notify.email. (Note: The standard NetMerchant setup script will generate two mail templates - notify.email which would go to the shop owner and verify.email which would go to the shopper.) If you call your template something else, you must refer to it from the confirm page using that name. The template uses html comment tags to get information from the NetMerchant and display it in the message. Below, you can see what our sample template looks like. Please note that in the interest of security, the full credit card number should never be transferred by e-mail or ftp. The field 'cardabbr' is a short version of the card number.
To:  <! billemail>
From: <! billemail>
Reply-to: <! billemail>
Subject: Secure Test Order

Billing Address:
<! billname>
<! billemail>
<! billaddress>
<! billcity>, <! billstate>   <! billzip>
<! billcountry>

Shipping Address:
<! shipname>
<! shipemail>
<! shipaddress>
<! shipcity>, <! shipstate>   <! shipzip>
<! shipcountry>

Date: <! DATE>
Order ID: <! ORDERID>
Card Number: <! cardabbr>
Shipping: <! shiptype>

Subtotal: $<! SUBTOTAL>
Shipping Cost: <! shipcost>
Tax: <! x_tax>
Amount Due: $<! GRANDTOTAL>

Qty		Item
---		----
<! ITEMLOOP>
<! QUANTITY>		<! ITEMID> <! DESCRIPTION> <! MODIFIER>
<! /ITEMLOOP>
HTML Mail Templates

If you would like your customers to receive a verification message with a more sophisticated design, you can format your messages using html. To do this, on the first line below the headers (the Subject line in the example above), enter text/html. Then, you can begin with your html code such as tables or other enhancements on the line below that. There is no need to include tags such as <html>, <head> or <body>.

Log Templates

For these instructions, we have used the log template file names log.file and full.file. You can create as many log files as you need. (Note: The standard NetMerchant setup script will generate four log templates - log.file and full.file as shown here and item.file having only item related information and order.file only having order related information). Every template file with the format prefix.whatever (like log.file) in your shop folder that you refer to from confirm.html with f_text will produce a file in your sweb/data folder with the name shopname.prefix (like testshop.log). There is one special case that doesn't follow the above protocol.You can name your data files with a .data extension in order to use our search script to display your logs. You do this by calling your template file anything.data. A template with this name will produce a data file with the .data extension. A typical use for this might be to create two tab delimited data files - one for orders and one for items that could be tied together using ordernumber.

In our sample shop, we have two files because we separate the record of the credit card information from the record of the order information that was sent via e-mail. If you call your templates something else, don't forget to refer to them from f_text in the confirm page using that name. The templates use html comment tags to get information from the NetMerchant and write it to the log files. Here's what our templates look like.

log.file
<! ORDERID>	<! cardnumber>	<! cardexp>	<! GRANDTOTAL>
full.file
<! ORDERID>	<! cardabbr>	<! cardexp>	<! GRANDTOTAL>

Billing Address:
<! billname>
<! billemail>
<! billaddress>
<! billcity>, <! billstate>   <! billzip>
<! billcountry>

Shipping Address:
<! shipname>
<! shipemail>
<! shipaddress>
<! shipcity>, <! shipstate>   <! shipzip>
<! shipcountry>

Date: <! DATE>
Order ID: <! ORDERID>
Card Number: <! cardabbr>

Subtotal: $<! SUBTOTAL>
Tax: <! x_tax>
Amount Due: $<! GRANDTOTAL>

Qty		Item
---		----
<! ITEMLOOP>
<! QUANTITY>		<! ITEMID> <! DESCRIPTION> <! MODIFIER>
<! /ITEMLOOP>

##################################################################################
Writing to SQL Tables

In order to use this feature, you must first sign up for ICG Link's SQL database feature to be assigned an SQL database. If your database name doesn't match your username, you must set up a DSN as shown on page one of these instructions, otherwise, NetMerchant will assume your database name and username match. Next, you should set up any tables you want NetMerchant to write to. The table may contain fields that NetMerchant doesn't use.

Include the following hidden field in confirm.html in place of the standard hidden field for f_text. (Note: If you include hidden fields for both f_mysql and f_text, the script will write to both SQL tables and text files.)
<input type="hidden" name="f_mysql" value="table1name,table2name">
where table1name.mysql and table2name.mysql are template files in the shop directory that describe how NetMerchant will write to the SQL tables. The names table1name and table2name must match tables in your SQL database. You can use any table names you like and you can write to any number of tables.

The template files are simple text files consisting of a single line with SQL table field names in parentheses, the word "values" and the NetMerchant field names in parentheses, all in comma delimited format. For example,
(fieldname1,fieldname2,fieldname3) values ("<! ordernum>",<! total>, "<! lname>")
It is not necessary to have NetMerchant write to all the fields in the table and it is not necessary to match the order of the fields in the table. The only requirements are that the fieldnames in your template match some field in the database and that they correspond in position with the field names from NetMerchant (in the example above, the SQL field name fieldname1 would be populated with the order number from NetMerchant). Whether or not the values are in quotes depends on what sort of data it is. The creator of the SQL database tables will be able to assist with this decision.

Card Number Encryption

NetMerchant automatically writes credit card numbers to log files in your www/data folder using an encryption algorithm. This means you can not view credit card numbers by accessing and reading the log file directly from your browser. Instead, we have built a decryption tool to access the log file and display it for you. You will need your ICG Link Admin password to use the tool. If you have never set up an Admin password, please call Customer Service and we will set it up for you.
Decryption Tool: https://secure.icglink.com/cgi-bin/secure_logview.pl
You will also need the name of your NetMerchant log file to use the tool.

Variables Available

You can enhance your shopping cart with additional system variables that are available. Following is a list of those variables broken into three sections. Those variables related to an item (found in the Item Loop), those related to the entire order and those special variables for use when selling files:
  • Item Loop Variables:
    • <! ITEMID> in the Item Loop, the ID for an item.
    • <! QUANTITY> in the Item Loop, the quantity of an item.
    • <! MODIFYQTY> in the Item Loop, this tag makes the button to allow a shopper to change the quantity of an item.
    • <! DESCRIPTION> in the Item Loop, the item's description.
    • <! UNITPRICE> in the Item Loop, the price of an item.
    • <! NETPRICE> in the Item Loop, the price of an item times the quantity for that item.
    • <! UNITSHIPPRICE> in the Item Loop, the shipping cost of an item.
    • <! NETSHIPPRICE> in the Item Loop, the shipping cost of an item times the quantity for that item.
    • <! UNITWEIGHT> in the Item Loop, this is the weight of an item.
    • <! NETWEIGHT> in the Item Loop, this is the weight of the item times the quantity for that item.
    • <! MODIFIER> in the Item Loop, all modifiers strung together.
    • <! MODIFIER1> in the Item Loop, Modifier 1 alone.
    • <! MODIFIER2> in the Item Loop, Modifier 2 alone.
    • <! MODIFIER3> in the Item Loop, Modifier 3 alone.
  • Order Related Variables:
    • <! SUBTOTAL> Order Value before shipping or discounts.
    • <! GRANDTOTAL> Total Order Value.
    • <! TOTALQTY> Total number of items in the cart.
    • <! TOTALWEIGHT> Total weight in the cart.
    • <! DATE> mm/dd/yyyy
    • <! ODBCDATE> yyyy-mm-dd
    • <! ODBCTIME> hh:mm:ss
    • <! TODAY> yyyymmdd
    • <! SEQNUM> big sequential number that increments each time an order is written (starting with 10000000000000).
    • <! ORDERID> order ID made up of the date and time followed by a hyphen and a sequential number incremented each time an order is written.
    • <! IP_ADDRESS> Shopper's IP.
  • Variables for Selling Files:
    • <! FILELINK>TEXT<! /FILELINK> will make TEXT a link to the file when using NetMerchant to sell files.
    • <! FILEURL> is the url to get the file when using NetMerchant to sell files.
    • <! FILEONLY>TEXT<! /FILEONLY> will display TEXT for files but not for other items when using NetMerchant to sell files. For example you might want to say "file will be accessible for 30 days" next to files you sell, but not next to T-Shirts.
ICG Link, Inc. 7003 Chadwick Drive, Suite 111, Brentwood, TN 37027