Sample HTML code for Web Site Developers
In the HTML directory for your SawShop store you will find two special
directories, and some sample files to help you get started. The
name and location of the 'templates', and 'products' directories
must remain as they are. You may name the files in your SawShop
store whatever you wish. The 'templates' directory is where you
put any files with dynamic content. When the store owner updates
the site from the maintenance page, the files and directory structure
in the 'templates' directory are copied to the 'products' directory
with the current data inserted into the pages. The following features
are described below:
Add Items
You can use any HTML input methods to add products to the cart. If adding a specified
quantity, the name of the field is the product ID, and the value is the new quantity. If the
quantity already in the cart is to be incremented, the name of the field is "add" and the value
is the product ID. Whatever input method you decide to use, the program you call in the form tag
is addtocart.pl, with your store ID appended with a question mark.
<FORM action="/cgi-bin/ecommerce/progs/addtocart.pl?yourStoreID"
method="post">
Please refer to the sample template, or the sample file in the
'template' directory of your store.
To enable the site to be updated from the maintenance area, you create templates
with special tags for the product information. The template files must be located in
the 'templates' directory for your site. When the pages are updated, all the files in
the templates directory are copied into the products 'directory' with the tags
replaced by the value from the database. The tags are as follows:
| $$P_Tag ID$$
| Retail price
|
| $$D_Tag ID$$
| Short description, same as in the shopping cart and order
email
|
| $$LD_Tag ID$$
| Long description
|
| $$I_Tag ID$$
| Image
|
| $$W_Tag ID$$
| Wholesale price |
The Tag ID must match an ID currently
in the product database.
Click here to see a sample template file.
View Cart
The content of the cart can be displayed in any file with the extension '.shtml'.
This is called a parsed html file. Before the server sends it to the client, it
parses the file, looking for server side includes (SSI). To make sure the current
content of the cart is displayed each time the page is accessed, you need to prevent
the page from being cached by the browser. This can be done by setting the META tag
"Pragma" to "no-cache".
<HEAD>
<META HTTP-EQUIV="Pragma" content="no-cache">
</HEAD>
The cart content will be displayed where ever the following
line appears:
<!--#exec cgi="/cgi-bin/ecommerce/progs/cart.pl -->
The content is displayed as entries in a table, with the quantities as input
fields. This means that the table and form tags must appear around the call to
cart.pl. The quantities appear as editable input fields. The program to update the
table is the same as was used to add the items, addtocart.pl, with the store ID
appended to the end.
Click here to see sample HTML code for displaying
the cart.
The store ID must be appended to the URL link that brings up the .shtml file. The
server side include will have the query string passed along to it. Below is a sample
link to a parsed html file displaying the cart content as in the above sample. You
can name this file whatever you wish, as long as it has the extension .shtml.
<A
href="somefile.shtml?yourStoreID">View Shopping Cart</A>
Empty Cart
The cart can be cleared from anywhere within the domain your store is in. The
program emptycart.pl takes the store ID as a query string.
<A href="/cgi-bin/ecommerce/progs/emptycart.pl?yourStoreID"
>Empty Cart</A>
Place Order
The program to submit the order is emailorder.pl. It takes the store ID as a
query string. The program will create an email with the content of the shopping cart, followed
by the names and values of the input fields in the orderform. To indicate a required field,
follow the input with a hidden input with the name 'required'.
Click here for an example section to collect customer
information for the order.
Receipt With Order Number
The name and location of the page to show after the order has been placed is
entered in the configuration for your store. The file must have the extension .shtml
if you want to insert the order number into the page. The order number will be
inserted wherever the following line appears:
<!--#exec cgi="/cgi-bin/ecommerce/progs/ordernum.pl -->
|