sent in the following hack...
This hack creates a dynamic table of contents to use instead of the
toc.html file. That way, if you change the categories in data.file,
your categories on your website will automatically reflect this change!
##first, you gotta edit the frames html file and change the line
)
{
chop($line); # Chop off extraneous newline
# Each field is split based on the pipe
# delimiter.
@fields = split(/\|/, $line);
$current_product = $fields[$sc_db_index_of_product];#get the product
$first_instance = 0;#assume it's the first instance
#now determine whether the product has already been added
foreach $product (@products) {
if ($product eq $current_product) {
$first_instance=1;
}
}
if ($first_instance==0) {
push(@products, $current_product);
$product_count++;
}
} # End of while datafile has data
# Finally, we close the datafile when
# we are done with it.
close (DATAFILE);
# We passed database rows by reference so that
# no extra copying of the array is needed when
# we return the status.
#
if ($product_count < 1) {#we didn't find anything
$status = "no_products";
}
# Finally, we return the status and
# the product count.
#
return($status,$product_count);
} # End of get_products
#note: if you are using Dan's inventory routine hack or another hack
#that accesses the data.file you'll have to add locking mechanisms in
#last: add this to your web_store_html_lib.pl file
#################################################################
#display_toc subroutine by The Red King
#
#usage:
# &display_toc($status, $product_count, *products);
#where
# $status is an error type deal
# *products is an array of products to be displayed);
# $product_count is obvious
#################################################################
sub display_toc {
local($status, $product_count, *products)= @_;
local($product);
#print the header
print qq!
you'll never see this, so it doesn't matter
Contents
!;
#print the products
foreach $product (@products) {
print qq~$product
~;
}
#print any errors
if ($status ne "") {
print qq~
$status~;
}
#print the footer
print qq~
Search Catalog
View Cart
Change Quantity Form
Delete Item Form
Order Form
~;
}#end of display toc
##you should change this html to reflect the way you want your toc to
##look.