I have been trying to adapt a free shopping cart on the Web site I am building for a friend. Its configuration was very difficult, but between the original version and the new version, I was able to make quite a few improvements, like the creation of a "Thank you" Web page at the end of a business transaction.
Technically, I should send you the entire program through the e-mail so that you can see it for yourself. Unfortunately, I cannot add an attachment to this message. Don't be alarmed, this is not a huge programming project, the code works but has some flaws, and I need an expert like yourself to give some advice for one particular problem only.
To have a better understanding of my problem, you may have to download the original free shopping cart at: and then hit the download link.
You will then see 4 folders:
cgi-bin, lucys, datafiles, and misc. cgi-bin and lucys are the folders of interest for my problem.
cgi-bin contains 4 files: admin.cgi, checkout.cgi, orders.cgi and setup.pl
lucys has many HTML files but only one is of interest: index.html which codes for the entry point of the shopping cart and is written in JavaScript.
Now after looking at the original shopping cart (Demo 1 or Lucy's shopping cart), please go to the Web site I have built, at the shopping cart Web page at:
Once in the page, after placing a fake order, then checking out, you will reach a Check Out page with "Order information", "Billing information", Shipping information" and "Credit card information".
Notice the section called "Order information" where you can see the shopping cart content in a tabulated form, and below it a subtotal, sales tax, shipping and a total.
After filling out the fields with bogus information, enter in the "Credit card information", 16 "zeros" then hit purchase, there you will reach my famous "Thank you" Web page.
You will then notice some missing items, such as all the information in the "Order information" section and in the sentence above it "Your order number is:" a number with 5 digits, which should look like this if your order number is for instance 94: 00094.
To make this "Thank you" page, I modified one file in cgi-bin called "orders.cgi." In it I replaced the last line of the code:
print 'Location:'.$thankspage.'?'.$counttext."\n\n";
with the code below to generate a new HTML page, buyers can print out after ordering.
# CODE:
print "Content-type: text/html\n\n";
print << "_FIN_";
<HTML>
<HEAD>
<LINK REL="stylesheet" HREF="style.css" TYPE="text/css">
<TITLE></TITLE> <SCRIPT>
function writesearch(){
var orderno=document.location.search;
orderno=orderno.substr(1);
document.write("<b>"+orderno+"</b>"
;
}
function clearorder(){
parent.cartcookie.delcookie();
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFF7DE" TEXT="#663333" LINK="#339900" VLINK="#9900FF"
ALINK="#FF3333">
<H2 ALIGN="CENTER">Souzao Enterprises online store</H2> <BR><BR>
<DIV ALIGN="center">
<H3>Thank You</H3></DIV>
<P>Thank you for shopping at the Souzao Enterprises online store. We
appreciate your business.</P>
<P>Your order number is: <SCRIPT>writesearch();</SCRIPT></P>
<P>Please print and keep this number for future reference.</P><BR><BR>
<DIV ALIGN="center"> <B>Order Information</B>
<FORM NAME="checkoutform" METHOD="post"
ACTION="<TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0">
<TR>
<TH BGCOLOR="#FFCC66">Product Id</TH>
<TH BGCOLOR="#FFCC66">Product Name</TH>
<TH BGCOLOR="#FFCC66">Options</TH>
<TH BGCOLOR="#FFCC66">Price</TH>
<TH ALIGN="center" BGCOLOR="#FFCC66">Quantity</TH>
<TH ALIGN="center" BGCOLOR="#FFCC66">Item Total</TH>
</TR>
<TR VALIGN="top">
<TD> </TD>
<TD> </TD>
<TD> </TD>
<TD ALIGN="right"> </TD>
<TD ALIGN="center"> </TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="o01Item"
VALUE="²r;²c;²r;">
</TABLE><BR>
<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="1">
<TR VALIGN="top">
<TD>Subtotal</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s01Subtotal"
VALUE="Subtotal²r;">
<TR VALIGN="top">
<TD>Sales Tax</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s02Salestax" VALUE="Sales Tax²r;">
<TR VALIGN="top">
<TD>Shipping</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s03Shipping"
VALUE="Shipping²r;">
<TR VALIGN="top">
<TD>Total</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s03Total" VALUE="Total²r;">
</TABLE> <HR></FORM></DIV><BR><BR>
<TABLE BORDER="1" CELLPADDING="10" CELLSPACING="0" ALIGN="CENTER">
<TR VALIGN="MIDDLE">
<TD BGCOLOR="#FFCC66" VALIGN="MIDDLE" ALIGN="CENTER">
<P><B>Bill to:</B></P></TD>
<TD BGCOLOR="#FFCC66" VALIGN="MIDDLE" ALIGN="CENTER">
<P><B>Ship to:</B></P></TD>
</TR>
<TR>
<TD><B>First Name:</B> $FORM{'a01FirstName'}<BR> <B>Last Name:</B>
$FORM{'a03LastName'}<BR> <B>Address1:</B> $FORM{'a04Address1'}<BR>
<B>Address2:</B> $FORM{'a05Address2'}<BR> <B>City:</B> $FORM{'a06City'}<BR>
<B>State/Province (US or Canada):</B> $FORM{'a07USState'}<BR> <B>State/Province
(outside US or Canada):</B> $FORM{'a08State'}<BR> <B>Zip/Postal Code:</B>
$FORM{'a09PostalCode'}<BR> <B>Country:</B> $FORM{'a10Country'}<BR></TD>
<TD><B>First Name:</B> $FORM{'b01FirstName'}<BR> <B>Last Name:</B>
$FORM{'b03LastName'}<BR> <B>Address1:</B> $FORM{'b04Address1'}<BR>
<B>Address2:</B> $FORM{'b05Address2'}<BR> <B>City:</B> $FORM{'b06City'}<BR>
<B>State/Province (US or Canada):</B> $FORM{'b07USState'}<BR> <B>State/Province
(outside US or Canada):</B> $FORM{'b08State'}<BR> <B>Zip/Postal Code:</B>
$FORM{'b09PostalCode'}<BR> <B>Country:</B> $FORM{'b10Country'}<BR></TD>
</TR>
<TR>
<TD><B>Coupon:</B> $FORM{'a15Coupon'}<BR></TD>
<TD><B>Insurance:</B> $FORM{'a16Insurance'}<BR></TD>
</TR>
<TR>
<TD COLSPAN="2"> <B>Information package:</B>
$FORM{'a17Informationpackage'}<BR><BR><B>Type of information package:</B>
$FORM{'a18Typeofinformation package'}<BR></TD>
</TR>
</TABLE> <BR><BR>
<P ALIGN="CENTER"><A
HREF=" Shopping</A>
<A
HREF=" TARGET="_top">Site
Home</A></P>
_FIN_
print"<br><br>";
print'</body></HTML>';
# END OF CODE
Notice that the shopping cart content is empty and so are the values next to subtotal, sales tax, shipping and total. I was not able to transfer them with $FORM{'value'}, because I have a hard time finding the exact name of these values in the file called index.html (lucys folder). For instance in index.html in lines 447 - 451 (if you have a numbering system in your editor) or after 3/4 of the beginning of the code, I see the following values:
's01Subtotal'
's02Salestax'
's03Shipping'
's03Total'
but once introduced in the $FORM{'values'}, they don't give the values you chose in the checkout page. As for the table of content, I don't know what values to pick.
Likewise, in the "Thank you" page, there should be an order number based on the code in orders.cgi.
printf ORDERS ("%05d", $count);
AND
$counttext = sprintf ("%05d", $count);
But it doesn't show up on the "Thank you" page, why?
I am hope that my question was clear. Thank you for your attention to this message.
Technically, I should send you the entire program through the e-mail so that you can see it for yourself. Unfortunately, I cannot add an attachment to this message. Don't be alarmed, this is not a huge programming project, the code works but has some flaws, and I need an expert like yourself to give some advice for one particular problem only.
To have a better understanding of my problem, you may have to download the original free shopping cart at: and then hit the download link.
You will then see 4 folders:
cgi-bin, lucys, datafiles, and misc. cgi-bin and lucys are the folders of interest for my problem.
cgi-bin contains 4 files: admin.cgi, checkout.cgi, orders.cgi and setup.pl
lucys has many HTML files but only one is of interest: index.html which codes for the entry point of the shopping cart and is written in JavaScript.
Now after looking at the original shopping cart (Demo 1 or Lucy's shopping cart), please go to the Web site I have built, at the shopping cart Web page at:
Once in the page, after placing a fake order, then checking out, you will reach a Check Out page with "Order information", "Billing information", Shipping information" and "Credit card information".
Notice the section called "Order information" where you can see the shopping cart content in a tabulated form, and below it a subtotal, sales tax, shipping and a total.
After filling out the fields with bogus information, enter in the "Credit card information", 16 "zeros" then hit purchase, there you will reach my famous "Thank you" Web page.
You will then notice some missing items, such as all the information in the "Order information" section and in the sentence above it "Your order number is:" a number with 5 digits, which should look like this if your order number is for instance 94: 00094.
To make this "Thank you" page, I modified one file in cgi-bin called "orders.cgi." In it I replaced the last line of the code:
print 'Location:'.$thankspage.'?'.$counttext."\n\n";
with the code below to generate a new HTML page, buyers can print out after ordering.
# CODE:
print "Content-type: text/html\n\n";
print << "_FIN_";
<HTML>
<HEAD>
<LINK REL="stylesheet" HREF="style.css" TYPE="text/css">
<TITLE></TITLE> <SCRIPT>
function writesearch(){
var orderno=document.location.search;
orderno=orderno.substr(1);
document.write("<b>"+orderno+"</b>"
}
function clearorder(){
parent.cartcookie.delcookie();
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFF7DE" TEXT="#663333" LINK="#339900" VLINK="#9900FF"
ALINK="#FF3333">
<H2 ALIGN="CENTER">Souzao Enterprises online store</H2> <BR><BR>
<DIV ALIGN="center">
<H3>Thank You</H3></DIV>
<P>Thank you for shopping at the Souzao Enterprises online store. We
appreciate your business.</P>
<P>Your order number is: <SCRIPT>writesearch();</SCRIPT></P>
<P>Please print and keep this number for future reference.</P><BR><BR>
<DIV ALIGN="center"> <B>Order Information</B>
<FORM NAME="checkoutform" METHOD="post"
ACTION="<TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0">
<TR>
<TH BGCOLOR="#FFCC66">Product Id</TH>
<TH BGCOLOR="#FFCC66">Product Name</TH>
<TH BGCOLOR="#FFCC66">Options</TH>
<TH BGCOLOR="#FFCC66">Price</TH>
<TH ALIGN="center" BGCOLOR="#FFCC66">Quantity</TH>
<TH ALIGN="center" BGCOLOR="#FFCC66">Item Total</TH>
</TR>
<TR VALIGN="top">
<TD> </TD>
<TD> </TD>
<TD> </TD>
<TD ALIGN="right"> </TD>
<TD ALIGN="center"> </TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="o01Item"
VALUE="²r;²c;²r;">
</TABLE><BR>
<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="1">
<TR VALIGN="top">
<TD>Subtotal</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s01Subtotal"
VALUE="Subtotal²r;">
<TR VALIGN="top">
<TD>Sales Tax</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s02Salestax" VALUE="Sales Tax²r;">
<TR VALIGN="top">
<TD>Shipping</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s03Shipping"
VALUE="Shipping²r;">
<TR VALIGN="top">
<TD>Total</TD>
<TD ALIGN="right"> </TD>
</TR><INPUT TYPE="hidden" NAME="s03Total" VALUE="Total²r;">
</TABLE> <HR></FORM></DIV><BR><BR>
<TABLE BORDER="1" CELLPADDING="10" CELLSPACING="0" ALIGN="CENTER">
<TR VALIGN="MIDDLE">
<TD BGCOLOR="#FFCC66" VALIGN="MIDDLE" ALIGN="CENTER">
<P><B>Bill to:</B></P></TD>
<TD BGCOLOR="#FFCC66" VALIGN="MIDDLE" ALIGN="CENTER">
<P><B>Ship to:</B></P></TD>
</TR>
<TR>
<TD><B>First Name:</B> $FORM{'a01FirstName'}<BR> <B>Last Name:</B>
$FORM{'a03LastName'}<BR> <B>Address1:</B> $FORM{'a04Address1'}<BR>
<B>Address2:</B> $FORM{'a05Address2'}<BR> <B>City:</B> $FORM{'a06City'}<BR>
<B>State/Province (US or Canada):</B> $FORM{'a07USState'}<BR> <B>State/Province
(outside US or Canada):</B> $FORM{'a08State'}<BR> <B>Zip/Postal Code:</B>
$FORM{'a09PostalCode'}<BR> <B>Country:</B> $FORM{'a10Country'}<BR></TD>
<TD><B>First Name:</B> $FORM{'b01FirstName'}<BR> <B>Last Name:</B>
$FORM{'b03LastName'}<BR> <B>Address1:</B> $FORM{'b04Address1'}<BR>
<B>Address2:</B> $FORM{'b05Address2'}<BR> <B>City:</B> $FORM{'b06City'}<BR>
<B>State/Province (US or Canada):</B> $FORM{'b07USState'}<BR> <B>State/Province
(outside US or Canada):</B> $FORM{'b08State'}<BR> <B>Zip/Postal Code:</B>
$FORM{'b09PostalCode'}<BR> <B>Country:</B> $FORM{'b10Country'}<BR></TD>
</TR>
<TR>
<TD><B>Coupon:</B> $FORM{'a15Coupon'}<BR></TD>
<TD><B>Insurance:</B> $FORM{'a16Insurance'}<BR></TD>
</TR>
<TR>
<TD COLSPAN="2"> <B>Information package:</B>
$FORM{'a17Informationpackage'}<BR><BR><B>Type of information package:</B>
$FORM{'a18Typeofinformation package'}<BR></TD>
</TR>
</TABLE> <BR><BR>
<P ALIGN="CENTER"><A
HREF=" Shopping</A>
<A
HREF=" TARGET="_top">Site
Home</A></P>
_FIN_
print"<br><br>";
print'</body></HTML>';
# END OF CODE
Notice that the shopping cart content is empty and so are the values next to subtotal, sales tax, shipping and total. I was not able to transfer them with $FORM{'value'}, because I have a hard time finding the exact name of these values in the file called index.html (lucys folder). For instance in index.html in lines 447 - 451 (if you have a numbering system in your editor) or after 3/4 of the beginning of the code, I see the following values:
's01Subtotal'
's02Salestax'
's03Shipping'
's03Total'
but once introduced in the $FORM{'values'}, they don't give the values you chose in the checkout page. As for the table of content, I don't know what values to pick.
Likewise, in the "Thank you" page, there should be an order number based on the code in orders.cgi.
printf ORDERS ("%05d", $count);
AND
$counttext = sprintf ("%05d", $count);
But it doesn't show up on the "Thank you" page, why?
I am hope that my question was clear. Thank you for your attention to this message.