This area is not intended to be a tutorial on building webpages. We can only provide the source code you need to add certain Shopping Cart functions to your web pages on e-BlackHills.com. There are many good sites on the Internet that teach html design. A popular one is at www.Builder.com
You can use this Shopping Cart on your existing web site! Simply call the pages from a Frame.
Secure software programs, such as this Shopping cart, actually have to be run on the server they are installed on. You won't be able to put the source code directly on web pages that are on a different domain. Instead make links from your web site to your pages on e-BlackHills.com You may choose to call the pages from a Frame such as on www.Menterwood-n-things.com.
Below are various Shopping Cart examples and their related Source Code.
1 Standard HTML templates for sending an item to the shopping cart:
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.
"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.
"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.
You may utilize the 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 Shopping Cart has two other discount features: Webstore Discount and Coupon Discount. See Personal Variables #52 and #59 in the ReadMe.
"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.
"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://"
Example:
<INPUT TYPE=HIDDEN NAME="return" VALUE="http://www.e-BlackHills.com/your-store/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.
"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.
"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.
"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.e-BlackHills.com/cgi-bin/cart.pl?merchant=yourstore?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.e-BlackHills.com/cgi-bin/cart.pl?merchant=YourStore?name=Purse&price=20&custom1=Black+Leather&custom2=%23noshipping%23
<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.e-BlackHills.com.com/YourStore/add.gif" NAME="Order">
Want to send multiple items to the shopping cart at one time with the use of checkboxes? 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:
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.
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, a default value of one will be given. 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 with check boxes 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.
3 HTML that allows customers to "view cart contents" or "checkout":
This is the HTML you use to display an image link that allows customers to "look" into their cart, or finish their purchase. Make sure you set the FORM ACTION to the correct URL. 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.
Example #1 (a link)
<A HREF="http://www.e-BlackHills.com/YourStore/cgi-bin/cart.pl?look|MerchantNameHere">
<IMG SRC="cart.gif" BORDER=0 ALT="View Your Shopping Cart"></A>
Example #2 (a form)
<FORM METHOD=POST ACTION="http://www.e-BlackHills.com/YourStore/cgi-bin/cart.pl">
<INPUT TYPE=HIDDEN NAME=return VALUE="http://www.e-BlackHills.com/YourStore/SuperWuper.html">
<INPUT TYPE=HIDDEN NAME=purpose VALUE="look">
<INPUT TYPE=IMAGE SRC="cart.gif" NAME="View Cart/Checkout" BORDER=0>
</FORM>
When using Example #2 above, just be sure to include this tag like you do in your HTML product forms:
<INPUT TYPE=HIDDEN NAME=merchant VALUE="MerchantNameHere">
4 Using the Shopping Cart search engine with flat-file databases:
This Shopping Cart has been upraded with new powerful search features. Make sure you add Database Variable #25 and #26 to your vars.html 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 lang.html file.
The form below shows you how the 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.html file.
Don't forget to use the "merchant" tag like so:
<INPUT TYPE=HIDDEN NAME="merchant" VALUE="MerchantName">
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:
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="http://www.e-BlackHills.com/cgi-bin/cart.pl">
<INPUT TYPE=HIDDEN NAME="merchant" VALUE="MerchantName">
<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="http://www.e-BlackHills.com/custom.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>
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: This 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>
6 Adding items to your cart with a link as opposed to a submit button:
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.
The Mall Version requires you to 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).