A simple form:
Make sure to change the ACTION attribute in the FORM tag of this form to match the full URL to where your cart.pl script is located. It needs to match Host Variable #1 in your vars.dat file exactly.
This HTML form...
<FORM METHOD=POST ACTION="https://www.dansie.net/cgi-bin/scripts/cart.pl"> <B> Black Leather purse with leather straps<BR> Price: $20.00<BR> </B> <INPUT TYPE=HIDDEN NAME=name VALUE="Black Leather Purse"> <INPUT TYPE=HIDDEN NAME=price VALUE="20.00"> <INPUT TYPE=HIDDEN NAME=sh VALUE="1"> <INPUT TYPE=HIDDEN NAME=img VALUE="purse.jpg"> <INPUT TYPE=HIDDEN NAME=img2 VALUE="purse_large.jpg"> <INPUT TYPE=HIDDEN NAME=return VALUE="https://www.dansie.net/demo.html"> <INPUT TYPE=HIDDEN NAME=custom1 VALUE="Black Leather purse with leather straps"> <INPUT TYPE=SUBMIT NAME="add" VALUE="Put in Shopping Cart"> </FORM>
Makes this...
Back to top.
A very comprehensive form:
This HTML form...
<FORM METHOD=POST ACTION="https://www.dansie.net/cgi-bin/scripts/cart.pl"> <B> Mens Tie<BR> Price: $40.00<BR> </B> <INPUT TYPE=HIDDEN NAME=name VALUE="Mens Tie"> <INPUT TYPE=HIDDEN NAME=price VALUE="40.00"> <INPUT TYPE=HIDDEN NAME=sh VALUE="1"> <INPUT TYPE=HIDDEN NAME=img VALUE="mens_tie.jpg"> <INPUT TYPE=HIDDEN NAME=img2 VALUE="mens_tie_large.jpg"> <INPUT TYPE=HIDDEN NAME=return VALUE="https://www.dansie.net/demo.html"> Size: <SELECT NAME=custom1 SIZE=1> <OPTION>Small $40.00 <OPTION>Large $50.00 </SELECT><BR> Color: <SELECT NAME=custom2 SIZE=1> <OPTION>Grey <OPTION>Blue <OPTION>Purple <OPTION>Polka Dot </SELECT><BR> With tie clip? <SELECT NAME=custom3 SIZE=1> <OPTION>No clip <OPTION>Clip +$10.00 </SELECT><BR> Quantity: <INPUT TYPE=TEXT NAME=quantity VALUE="1" SIZE=2 MAXLENGTH=2><BR> <INPUT TYPE=SUBMIT NAME="add" VALUE="Order"> </FORM>
Makes this... Back to top.
Explanation of HTML tags:
"ACTION" in the <FORM> tag above must be used in all forms. Set the ACTION URL to the URL where your cart script is located. It needs to match the URL in Host Variable #1 in your vars.dat file exactly.
"name" in the <INPUT TYPE=HIDDEN> tag above must be used in all forms. Set the name to whatever you want.
"price" in the <INPUT TYPE=HIDDEN> tag above, likewise, must be used in all forms. Set the price to whatever you want.
Volume Discount Pricing method."sh" in the <INPUT TYPE=HIDDEN> tag above stands for Shipping and Handling. You only need to use this tag if you have Personal Variable #27 set to "1" (using shipping calculated by the weight of each item method). See the ReadMe for details on Personal Variable #27. Set this to how many pounds/kilos that this item weighs.
You may utilize the Dansie Shopping Cart's volume discount pricing capabilities. Just set the value of this tag like so:
<INPUT TYPE=HIDDEN NAME=price VALUE="3.00:1:2.50:10:2.00:20">
Explanation:
$3.00 for 1 or more.
$2.50 for 10 or more.
$2.00 for 20 or more.
Etc... Use the colon ":" for the delimiter.
The Dansie Shopping Cart has two other discount features: Webstore Discount and Coupon Discount. See Personal Variables #52 and #59 in the ReadMe.
"img" in the <INPUT TYPE=HIDDEN> tag above stands for "image". The use of this tag is optional. If you would like a thumb-nail image of this item to appear in the cart, then set the value of this tag to the full URL of the image you want to use. You may also put just the image name and the cart script will use the "images directory" that you specified in Host Variable #3 as its location. You may make the width and height of your thumb-nail images uniform with the help of Database Variable #18.
"img2" in the <INPUT TYPE=HIDDEN> tag above stands for "larger image". The use of this tag is optional. If you would like your thumb-nail images to be linked to larger images, then set the value of this tag to the full URL of the image you want to use. You may also put just the image name and the cart script will use the "images directory" that you specified in Host Variable #3 as its location.
"return" in the <INPUT TYPE=HIDDEN> tag above is optional. If you wish to specify what page your customer returns to when they click the "Continue Shopping" button at the bottom of the cart display, then set the value of this tag to the full URL of the page you want them to return to. A full URL begins with "http://" (or "https://" if you are using a site security certificate). Example:
<INPUT TYPE=HIDDEN NAME="return" VALUE="http://www.YourName.com/page.html">
And NOT like this:
<INPUT TYPE=HIDDEN NAME="return" VALUE="page.html">
If you don't use this tag in your forms, then the URL your customers will "Continue Shopping" at will be the "default return shopping URL" that you specified in Host Variable #2.
If your "return" variable has a query string inside the URL, then encode these characters: (?,=,&) with these respective URL encodings: (%3F,%3D,%26).
"quantity" in the <INPUT TYPE=TEXT> tag above is optional. If you wish to allow your customers to choose their quantity then you can use this tag. If you don't use this tag, the cart will use a default quantity of 1. Your cart gives you the ability to change quantity later after the item is in the cart too.
"custom1" (the name of the "size" <SELECT> pull-down menu above) has the ability to actually change the price of the item. This is done with the use of your currency symbol (Personal Variable #36) followed by a numeric value at the end of the <OPTION> tag.
<OPTION>Small $40.00
<OPTION>Large $50.00
Avoid using currency symbols in custom description tags unless you intend to activate the cart's price change feature and change the price of an item. If you really desire to use a dollar sign but not change the price, use the Small Dollar Sign as a substitute. Set Personal Variable #56 in your vars.dat file with: <meta charset="UTF-8">
Then, use the Small Dollar Sign HTML entity like so: <INPUT TYPE=HIDDEN NAME=custom1 VALUE="You saved ﹩5.">
That's ﹩ followed by your dollar amount (5 in this example). It will appear as "You saved $5".
"custom2" (the name of the "color" <SELECT> pull-down menu above) has the ability to send a custom description to the shopping cart with this item, but not change the price of the item because the currency symbol is not in the tag.
"custom3" (the name of the "With tie clip?" <SELECT> pull-down menu above) has the ability to actually add to the price of the item. This is done with the use of the plus sign (+) followed by your currency symbol (Personal Variable #36) followed by a numeric value at the end of the <OPTION> tag. <OPTION>Clip +$10.00
You could even have it subtract from the price. Say the ties come with a clip as default... <OPTION>Without Tie Clip +$-10.00
Just insert a "-" in front of the amount you want to subtract.
"custom100" You may use as many custom descriptions that you want in your forms. Just make sure you set Personal Variable #1 in your "vars.dat" file to the highest number of "customs" that your cart will use in any given HTML form. The default is set at 20.
"merchant" For use with the Mall Version. See the Mall Version section of the ReadMe for details.
"redirect" This works with the "Add and Redirect" feature. See Personal Variable #49 in the ReadMe. If you would like a few HTML product forms to deviate from the default settings that you put in PV#49, then you can use this tag in your HTML forms:
<INPUT TYPE=HIDDEN NAME=redirect VALUE="1">
or
<INPUT TYPE=HIDDEN NAME=redirect VALUE="2">
"#nontaxable#" If you have the cart set to calculate sales tax (see Personal Variable #12) but you don't want sales tax calculated on one item, then use a tag like so:
<INPUT TYPE=HIDDEN NAME="custom1" VALUE="#nontaxable#">
If you are using the <A HREF> method of adding items to the cart, then use %23 encoding for the pound signs like so:
http://www.YourName.com/cgi-bin/cart.pl?name=Purse&price=20&custom1=Black+Leather&custom2=%23nontaxable%23
"#noshipping#" If you have the cart set to calculate shipping according to the subtotal (see section 10 in the ReadMe. This is when you have Personal Variable #27 set to 2.) but you don't want shipping considered on one item, then use a tag like so:
<INPUT TYPE=HIDDEN NAME="custom1" VALUE="#noshipping#">
If you are using the <A HREF> method of adding items to the cart, then use %23 encoding for the pound signs like so:
http://www.YourName.com/cgi-bin/cart.pl?name=Purse&price=20&custom1=Black+Leather&custom2=%23noshipping%23
"#nodiscount#" If you have the cart set to use Webstore or Coupon discounts (see Personal Variables #52 and #59 in the ReadMe) but you want certain items to always be full price and never be discounted, then use a tag like so:
<INPUT TYPE=HIDDEN NAME="custom1" VALUE="#nodiscount#">
If you are using the <A HREF> method of adding items to the cart, then use %23 encoding for the pound signs like so:
http://www.YourName.com/cgi-bin/cart.pl?name=Purse&price=20&custom1=Black+Leather&custom2=%23nodiscount%23
In order to reduce confusion for your customers it is highly recommended to include another custom description tag like this:
<INPUT TYPE=HIDDEN NAME="custom2" VALUE="No discounts on this item.">
Back to top.
Using other form elements:
Examples:
<INPUT TYPE=CHECKBOX NAME="custom1" VALUE="With tie clip? +$10.00"> <INPUT TYPE=RADIO NAME="custom2" VALUE="No tie clip"> <INPUT TYPE=RADIO NAME="custom2" VALUE="With tie clip +$10.00"> What initials would you like embroidered into your tie? <INPUT TYPE=TEXT NAME="custom3" SIZE=20 MAXLENGTH=20> What initials would you like embroidered into your tie? <TEXTAREA NAME="custom4" COLS=30 ROWS=3></TEXTAREA> You may use standard submit buttons or images like so: Standard submit button: <INPUT TYPE=SUBMIT NAME="add" VALUE="Put in Shopping Cart"> Custom image submit button: <INPUT TYPE=HIDDEN NAME="add" VALUE="1"> <INPUT TYPE=IMAGE SRC="http://www.YourSite.com/add.gif" NAME="Order">
Do you want to send multiple items to the shopping cart at one time with the use of quantity text boxes and just one submit button?
This HTML form...
<FORM METHOD=POST ACTION="https://www.dansie.net/cgi-bin/scripts/cart.pl"> Item: Quantity:<BR> <INPUT TYPE=HIDDEN NAME="name" VALUE="multi-items"> <INPUT TYPE=HIDDEN NAME="return" VALUE="https://www.dansie.net/demo.html"> <INPUT TYPE=HIDDEN NAME="multi-item1" VALUE="Banana Split|3.95|1|split.jpg|A delicious ice cream treat."> Banana Split <INPUT TYPE=TEXT NAME="quantity1" SIZE=2 MAXLENGTH=2><BR> <INPUT TYPE=HIDDEN NAME="multi-item2" VALUE="Pineapple|2|1|pineapple.jpg|A juicy pineapple."> Pineapple <INPUT TYPE=TEXT NAME="quantity2" SIZE=2 MAXLENGTH=2><BR> <INPUT TYPE=HIDDEN NAME="multi-item3" VALUE="Watermelon|3|1|watermelon.jpg|A ripe watermelon."> Watermelon <INPUT TYPE=TEXT NAME="quantity3" SIZE=2 MAXLENGTH=2><BR> <INPUT TYPE=SUBMIT NAME="add" VALUE="Put these in my cart!"> </FORM>
Makes this...
(Be sure to enter a number such as "1" into one or more of the quantity text boxes above.)
This HTML form...
<FORM METHOD=POST ACTION="https://www.dansie.net/cgi-bin/scripts/cart.pl"> Item:<BR> <INPUT TYPE=HIDDEN NAME="name" VALUE="multi-items"> <INPUT TYPE=HIDDEN NAME="return" VALUE="https://www.dansie.net/demo.html"> <INPUT TYPE=CHECKBOX NAME="multi-item1" VALUE="Banana Split|3.95|1|split.jpg|A delicious ice cream treat."> Banana Split <INPUT TYPE=HIDDEN NAME="quantity1" VALUE="1"><BR> <INPUT TYPE=CHECKBOX NAME="multi-item2" VALUE="Pineapple|2|1|pineapple.jpg|A juicy pineapple."> Pineapple <INPUT TYPE=HIDDEN NAME="quantity2" VALUE="1"><BR> <INPUT TYPE=CHECKBOX NAME="multi-item3" VALUE="Watermelon|3|1|watermelon.jpg|A ripe watermelon."> Watermelon <INPUT TYPE=HIDDEN NAME="quantity3" VALUE="1"><BR> <INPUT TYPE=SUBMIT NAME="add" VALUE="Put these in my cart!"> </FORM>
Makes this...
The first example form above uses quantity TEXT fields with no checkboxes. The second example form above uses checkboxes with a default quantity of "1" for each item. Choose the type that best suits your needs. Make sure you set the "name" tag to "multi-items". For each item, use "multi-item1", "multi-item2", etc. The value of each multi-item is four or more fields separated by the "|" delimiter. The key to the fields are as follows:name|price|shipping|image|custom1|custom2|custom3|etc.You may use a quantity text box with each multi-item. Just give it a corresponding number such as "quantity1", "quantity2", etc. If you omit the quantity text box, you should use a HIDDEN quantity tag instead with a default value of "1".
Or if linking your thumbnails to larger images:
name|price|shipping|image::image2|custom1|custom2|custom3|etc.
Use two colons as the sub-delimiter between the image names.
<INPUT TYPE=HIDDEN NAME="quantity1" VALUE="1">
Be sure to set Personal Variable #1 to the number of the largest number of multiple items you have in a form. For example, if you have a form that has 50 multiple items in it, set Personal Variable #1 to 50. The cart script wont look for any items higher than that array.
"multi-items" HTML form limitations:
If you use "multi-items" forms, then you can't use any comprehensive capabilities with them. In other words, you can't put a bunch of pull-down menus next to each product. The way that "multi-items" forms work best is with a huge list of products down the page that don't need any extra custom descriptions.
If you want to use comprehensive forms, you will be able to do many powerful things, but a "Put in cart" button will need to accompany every individual product.
This is the HTML you use to display an image link that allows customers to "look" into their cart and/or finish their purchase (checkout). Make sure you set the FORM ACTION to the same URL that you have in Host Variable #1 of your vars.dat file. Also, set the proper URL to the cart.gif. It is recommended to have this image link on every page of your website. If your website uses frames, it is recommended to have it in your toolbar frame and use TARGET. The use of the Server Side Includes (SSI) tag below is optional. If you wish to use SSI tags but they are not working, contact your web host and ask them to enable SSI for you.
|
View Your Shopping Cart |
|
The above cart.gif image may not show if you are not connected to the internet. |
|
The above cart.gif image may not show if you are not connected to the internet. |
<!--#include virtual="/cgi-bin/cart.pl?summary"--> |
Shopping Cart Summary Items in basket: 16 Subtotal: $ 33.00 |
|
This button will properly demonstrate when you are connected to the internet. |
Be sure to set lang.dat variables #167, 168 and 169 in your lang.dat file or the summary display may be blank or missing text.
Mall Version Notes
If you are using the Dansie Shopping Cart Mall Version, when using the <A HREF> HTML above, you will need to link to the cart like so:
http://www.yourname.net/cgi-bin/cart.pl?look|MerchantNameHere
First put "?", then "look", then "|", then the merchant's name. Example:
<A HREF="http://www.YourName.net/cgi-bin/cart.pl?look|AcmeWidgets">
With the Dansie Shopping Cart Mall Version, when using the HTML form above, just be sure to include this tag like you do in your HTML product forms:
<INPUT TYPE=HIDDEN NAME=merchant VALUE="MerchantNameHere">
With the Dansie Shopping Cart Mall Version, the SSI tag example above will only work if the web page you insert the SSI tag in is also the same server and domain the cart.pl script is running on. However, the JavaScript pop-up will always work if the merchant's web site is on a different domain than the cart.pl script. Be sure to include the merchant name in the include path or URL like so:
<!--#include virtual="/cgi-bin/cart.pl?summary|AcmeWidgets"-->
http://www.YourName.net/cgi-bin/cart.pl?summary|AcmeWidgets
Dansie Shopping Cart version 3.0 has been upgraded with new powerful search features. Make sure you add Database Variable #25 and #26 to your vars.dat file to take advantage of these new powerful features. Also, make sure you have lang.dat #91 through 96 and 149 and 150 from the 3.0 lang.dat file. If you wish to use the 3.0 search engine, then set Database Variable #25 in your vars.dat file to "3.0". If you want to remain with the old 2.0 search format, then just leave DBV#25 blank or set it to "2.0".
The form below shows you how the Dansie Shopping Cart can search your flat-file databases for the products. Copy and paste it into one of your web pages. Make sure you change the FORM ACTION to the URL to the cart.pl script on your site. It will be the same URL as you have in Host Variable #1 in your vars.dat file.
The location of your database file is either in the same directory as your vars.dat file (default), or a different directory that you set in Database Variable #1 in your vars.dat file. With the Mall Version database files need to be located in the merchants directory and don't forget to use the "merchant" tag like so:
<INPUT TYPE=HIDDEN NAME="merchant" VALUE="MerchantName">
Feel free to name your database files whatever you like and use as many as you need.
You will find 7 form variables below. db, category, search, method, price, display and return. The only variable that is required is db because you must tell the script which file to search. The rest are optional. If you do not define category, then all categories in the database file will be searched. If you do not define search (with key words) then all items will be displayed. By using the price variable you can search for specific price ranges. If you omit price then all items can be matched regardless of their price. The method variable allows your shoppers to search for "any words", "all words" or a "phrase". If you omit the method variable the default search method will be "any words". The display variable allows your shoppers to control how many items are displayed per page. The return variable allows you to tell the cart what URL to take a shopper to when they click the "Continue Shopping" button. If you omit this variable, the cart will use the URL you put in Database Variable #23 and if you have that blank, the return URL will be a link right back to the database display they just came from.
Foreign character search compatibility: If you have characters in your database such as any of these:
ŠšŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ
The cart will return a match for words with those characters in them even if the shopper didn't type in the exact character. For example, someone searches for "El Nino" but you have "El Niño" in your product database, the cart will match it with or without the tilde "~". The reverse is true too. If someone searches for "Alegría" and you have "Alegria" in your database without the accent, the cart will still match it.
HREF links can be used just as well. Here are some examples:
https://www.dansie.net/cgi-bin/scripts/cart.pl?db=stuff.dat
The only variable passed is db so all items are returned.
https://www.dansie.net/cgi-bin/scripts/cart.pl?db=stuff.dat&category=Books
category is defined so the script only returns items in that category.
https://www.dansie.net/cgi-bin/scripts/cart.pl?db=stuff.dat&category=Books&search=Boy+Scout
Now "Boy Scout" is the key word search criteria so the script only returns matches for that in the "Books" category. Notice that you use plus signs (+) for spaces inside URLs.
This HTML form...
Makes this...
Required Fields:
This requires the use of JavaScript. Make sure to change the ACTION attribute in the FORM tag of this form to match the full URL to where your cart.pl script is located. It needs to match Host Variable #1 in your vars.dat file exactly. If a shopper has JavaScript enabled in their browser, the two text fields will be required. If they don't, the fields wont be required, but the form will still work. Try clicking the "Order Now!" button below without entering a first or last name. It will prevent you from moving to the next page until you enter those required fields.
- Copy and paste the JavaScript function into the top of your document.
- Put NAME="form1" in your FORM tag.
- Use the purple tags below in place of your submit button.
This JavaScript and HTML form...
<SCRIPT LANGUAGE="JavaScript"> function RequiredFields() { if (!document.form1.custom3.value || !document.form1.custom4.value ) { alert("Please enter all required fields."); } else { document.form1.submit(); } } </SCRIPT> <FORM NAME="form1" METHOD=POST ACTION="https://www.dansie.net/cgi-bin/scripts/cart.pl"> <B> Black Leather purse with leather straps<BR> Price: $20.00<BR> </B> <INPUT TYPE=HIDDEN NAME=name VALUE="Black Leather Purse"> <INPUT TYPE=HIDDEN NAME=price VALUE="20.00"> <INPUT TYPE=HIDDEN NAME=sh VALUE="1"> <INPUT TYPE=HIDDEN NAME=img VALUE="purse.jpg"> <INPUT TYPE=HIDDEN NAME=img2 VALUE="purse_large.jpg"> <INPUT TYPE=HIDDEN NAME=return VALUE="https://www.dansie.net/demo.html"> <INPUT TYPE=HIDDEN NAME=custom1 VALUE="Black Leather purse with leather straps"> <INPUT TYPE=HIDDEN NAME=custom2 VALUE="First and last name to be embroidered on purse:"> Name to be embroidered on purse:<BR> First Name: <INPUT TYPE=TEXT NAME=custom3 SIZE=20 MAXLENGTH=30><BR> Last Name: <INPUT TYPE=TEXT NAME=custom4 SIZE=20 MAXLENGTH=30><BR> <SCRIPT LANGUAGE="JavaScript"> document.write('<INPUT TYPE=HIDDEN NAME="add" VALUE="1">\n<INPUT TYPE=BUTTON VALUE="Order Now!" OnClick="RequiredFields()";>'); </SCRIPT> <NOSCRIPT> <INPUT TYPE=SUBMIT NAME="add" VALUE="Order Now!"> </NOSCRIPT> </FORM>
Makes this...
Custom measurements:
Custom measurements, or quantity of additional tag-along items. This can be used to ask, "How many square yards of carpet will you need?" This could also be used to ask, "How may additional red roses do you want delivered with the basket?" You only need to change variables s,e and c. Make sure "custom1" is the correct name. I wouldn't tamper with the rest unless you know a little about JavaScript. Note: Dansie Shopping Cart is compatible with JavaScript 1.2, 1.0 and it will even work if a web browser has it's JavaScript turned off. However, using JavaScript in your forms wont work if a customer has his JavaScript turned off in their browser.
This JavaScript example:
<FORM> Length:<BR> <SELECT NAME="custom1" SIZE=2> <SCRIPT LANGUAGE="JavaScript"> var i = 0 // Initialize var s = 10 // Length Start value var e = 20 // Length End value var inc = 1 // Increment each time var c = 1 // Cost in units of money per extra unit of length (1 = $1.00 etc.) for (var i = s; i<= e; i+=inc) { document.write ("<OPTION VALUE=\"+$"+(i-s)*c+"\">"+i+"\n") } </SCRIPT> </SELECT> <BR> </FORM>Makes this...
You may add items to your cart with <FORM> tags and submit buttons as you see in section 1 and 2 of Template.html or you may use the GET method too by passing the name/value pairs to the cart.pl script in a query string.
Here is an example:
https://www.dansie.net/cgi-bin/scripts/cart.pl?name=Purse&price=20&custom1=Black+Leather
Here are the rules:Here is another example:
- First link to the full URL to your cart.pl script.
- Then put a question mark.
- The first variable name must be "name" as you see above.
- Use the equal sign "=" to separate the names from the values.
- Use the ampersand "&" to separate each name/value pair.
- Since we can't put a space character in a URL, subsitute those with the plus sign "+".
- Use all the variable names you like as you find them in section 1C of Template.html.
https://www.dansie.net/cgi-bin/scripts/cart.pl?name=Purse&price=20&custom1=Black+Leather
&custom2=Large&quantity=3&sh=1&img=purse.jpg&return=https://www.dansie.net/cart.html
If you have the Mall Version then use the merchant variable like so:
&merchant=MerchantName
If you would like to pass a URL with the "return" variable and it has a query string inside the URL, then encode these characters: (?,=,&) with these respective URL encodings: (%3F,%3D,%26).