If you want SurfShop™ to display the originating catalog page form instead of the customer's cart when an item is added, include the “return_page” parameter and set its value to the URL of the page to which you wish the customer to return. After SurfShop™ adds the item to the customer's cart, it will display the page passed in the “return_page” field.
<! add:item> place holder is included on this page, SurfShop™ will display a message confirming that the item was added.
<form action="/cgi-bin/surfshop/shop.cgi"> <input type="text" name="i_125dogfoo" size="3" value="1"> <input type="submit" name="addToCart" value=" Add to Cart "> <input type="hidden" name="scount" value="1"> <input type="hidden" name="storeid" value="1"> <input type="hidden" name="return_page" value="/sample.htm"> </form>
As a hyperlink:
<a href="/cgi-bin/surfshop/shop.cgi?i_125dogfoo =1&scount=1&storeid=1&return_page=/sample.htm"> <! add:item>
When the page is displayed,
<! add:item> will be replaced by the phrase, “This item has been added to your cart,” followed by the options corresponding to the last item added. You can change the phrase that is displayed by modifying the output message file, msgs.dat.
Note: the return page must exist in your document root. SurfShop™ cannot return pages that are not part of your local website.
SurfShop™ gives you the ability to check user input different ways so that you can customize your forms to your needs. We recommend that you only verify data that absolutely must be entered correctly (such as e-mail addresses, phone numbers and zip codes). These options are available if you need them, but use them judiciously. These methods can be added as “hidden” input fields on the info.htm template, as well as any other form you pass to SurfShop™ from your website.
Certain fields are required in order for an order to be completed. If you want require a form field to be filled in, add a hidden field to the template named “required,” whose value contains a list of all of the required fields:
<input type="hidden" name="required" value="Ecom_BillTo_Postal_Name_First,Ecom_BillTo_Postal_Name_Last">
SurfShop™ will automatically check that the user has included information in each of the fields listed in the “required” field.
SurfShop™ includes several ways to verify a form field based on the contents of the input. To use this feature, include a hidden input tag whose name contains “v_” followed by the name of the field you wish to verify.
If any field does not pass the verification, an error is generated (like required fields) telling the user to go back and fix the data. You can also use the verification instead of the “required” field, since data will be required as a by-product of the routine.
<input type=hidden name="v_[fieldname]" value="type,value,value2,chartype">
“fieldname” refers to the form field you are verifying. “type,” “value,” “value2,” and “chartype” are arguments that tell SurfShop™ how to verify the data.
The verification routine removes any parentheses or dashes before checking the strings.
Checks Credit Card fields for validity. The field associated with the “v_” prefix is arbitrary. This check checks the five Payment Fields regardless of which field is actually specified by the “v_” prefix.
When the “card” value is sent, SurfShop™ (1) checks each of the credit card fields for values; (2) checks the cardnumber length; (3) checks that the number corresponds to the card type; and (4) performs a standard Mod-10 check against the card number. The following credit cards are supported: Visa, MasterCard, American Express, Discover, Diners Club, JCB, Switch, and Solo.
Verifies that the necessary fields have been entered for an e-check. The field associated with the “v_” prefix is arbitrary. Fields required by “check”: Check Number, Routing Number, Transit Number, and Account Number.
Performs a standard e-mail verification. No other arguments are necessary.
Checks the data for either 5 or 9 numerals (with or without dashes). No other arguments are necessary. Exact checks that the data contains exactly value or value2 (optional) characters of chartype (num, letnum, alpha) If only value is used, leave value2 empty (no space between commas).
Checks that the data contains at least value but not more than value2 characters of chartype.
Checks that the data begins with at least value characters of chartype
You want to check the form field “password” for a range between four and ten alphanumeric (including underscore) characters:
<input type=hidden name=v_password value="range,4,10,alpha, Password must be at least 4 but not more than 10 alphanumeric characters.">
If you want to make sure an e-mail is valid:
<input type=hidden name="v_Ecom_BillTo_Online_Email" value="email">
If you want to give the user a message:
<input type=hidden name="v_Ecom_BillTo_Online_Email" value="email,,,, Not a valid email address.">
If you want to check the field “phone” for exactly ten numerals (including area code):
<input type=hidden name="v_Ecom_BillTo_Telecom_Phone" value="exact,10,,num,Phone number must be exactly ten digits.">
If you want to check for a valid zip code:
<input type=hidden name="v_zip" value="zip">
If you want to give the user a message:
<input type=hidden name="v_Ecom_BillTo_Postal_PostalCode" value="zip,,,,Zip code must contain either 5 or 9 digits.">
If you want to make sure the street address name starts with at least 2 letters or numbers:
<input type=hidden name="v_Ecom_BillTo_Postal_Street_Line1" value="start,2,,letnum, Address must begin with two characters.">
You can manipulate the output templates, including the Email Messages, to change the output depending on the value of certain place holders using the
<! if:….><! /if> and
<! iff:…><! /iff> tags.
Place the output you wish to display inside the
<! if:…> containers:
<! if:[placeholder]:[conditional]:[value]> Show this text if the above expression is true... <! /if>
If you need to nest two conditions inside each other, you must use the
<! iff:…><! /iff> place holder instead. You cannot nest any more conditionals inside an
<! iff:…><! /iff> place holder, however you can use as many
<! if:..><! /if> and
<! iff:…><! /iff> place holders next to each other as necessary.
Order ID: <! orderid><! if:PmtType:eq:CreditCard> Card Type: <! Ecom_Payment_Card_Type> Card #: <! cardabbr><! /if><! if:PmtType:eq:Check> Check # <! Ecom_Payment_Check_Number><! /if><! if:shiptype:ne:> Ship Via: <! shiptype><! /if>
In this example, the program tests to see if PmtType is “CreditCard” or “Check” and displays the appropriate output fields. It then tests if shiptype has a value and displays it if it does. More examples can be seen throughout the various output templates.