Angelina Hedgepeth sent in the following Web Store Hack which
allows users
to keep track of the status of their orders. Here is the text
of the mail she sent in....
...NOTE: I'm using the database version and I do not like to
write the entire order to a log. Instead I just write
the order # and default status to a logfile (you
can use order.log if you want).
In your setup file (I use the database version) in the routine
that begins with:
###################################
# Order Form Definition Variables #
###################################
you will find the follwoing array definition
@sc_order_form_required_fields =
("01-name",
"02-b_street_address",
"03-b_city",
"04-b_state",
"05-b_zip",
"12-phone",
"14-e-mail");
Here is what to add:
# 09/15/98-ADH Defined field $sc_order_no = (); to
# hold a duplicate copy of the cart_id which will
# later be written to the order log.
$sc_order_no = ();
Next, make sure this field set to YES. It is futher
down in this section.
$sc_send_order_to_email = "yes";
Next, open WEB_STORE_HTML.PL for editing....
Find CART_TABLE_HEADER_TABLE_SUBROUTINE
Somewhere after the Close Cart statement I put this:
$sc_order_status =
("Order #: $cart_id has not been processed||");
$sc_order_no = "$cart_id";
Next, open WEB_STORE_ORDER.PL
I CHANGED this code which write the entire
order to a log file file from this:
if ($sc_send_order_to_log =~ /yes/i) {
open (ORDERLOG, ">>$sc_order_log_file");
print ORDERLOG "-" x 40;
print ORDERLOG $text_of_cart;
print ORDERLOG "-" x 40 . "\n";
close (ORDERLOG);
}
TO THIS:
$sc_order_no = "$cart_id";
if ($sc_send_order_to_log =~ /yes/i) {
open (ORDERLOG, ">>$sc_order_log_file");
print ORDERLOG $sc_tracking_msg,$sc_order_no;
print ORDERLOG "\n";
close (ORDERLOG);
}
here's the search script
Put it in your Admin_files Directory and change the
filename in the script to the name of your log file. Setup
permissions for this script as follow:
rwxr
xr x
NOTE: This original script can be found at:
http://www.technotrade.com/cgi/search.html
was written by Techno Trade
http://www.technotrade.com.
It was designed to search for URL's and to add info however I commented
out what I didn't need to make it work with my order tracking database.
There is a small flaw using the Techno Search script. It display
the first file in the database if you enter say a 1. However to get
around that I just put some error messages in the file as you will see
later in this documentation.
If anyone comes up with a better solution please share it with me.
This is the Tracking Html Main Page
=====================
Note: The search script needs to be modified to specifically work for
the tracking but as I said before I am no expert at cgi so someone more
advance will have to do this. hopefully it will be shared with me. Hopefully
i've covered everything.
What the SAMPLE tracking database will look like when the order tracking
message and # is;
Order # 8741553.20283 has not been processed||8741553.20283
So in theory unless you use a different search script it would be a
good idea to put in error messages in case someone tries to get information
from your database by inputting a single #. It seems to happen only
when 1 is entered but it's best to put in a line for 0-9 just be safe like
below;
Sorry that is not a valid order #||1 (you
might want to do this for 0, and also numbers 2-9.)
Order # 8741553.20283 has not been processed||8741553.20283
Please read up on security issues about using the | in your code.
I seem to remember having to be careful about using it. I don't know
if it would appear to your database file. Please not I am not
responsible
for any problems, etc. associated with using this information. It
is meant as information only.
If it doesn't work let me know and I'll research a little more
to see what else I might have done.
Angelina H.
http://www.angelfire.com/biz/promots/toc.html to reach
me click on the email link below;