Prohibit checkout with empty cart? : LUSENET : S-Mart Shopping Cart : One Thread

Is there a way to prohibit a checkout with the user filling in the order form if the shopping cart is empty. I have a new site up, and people for some strange reason are sending an order, and then going back 10 minutes later to add more comments or special instructions by sending a blank order, instead of using the email links.

Thanks to those who helped on my last issue!

-- Bryan T (, April 20, 2000


Inside the buy_items2 routine of S-Mart.cgi, add an IF test. Here's an example:

sub buy_items2 { if($SIZE > 1) #this needs to be 1, not 0 { #all the code normally in the routine goes here } else { &print_header; print "There is nothing in your shopping cart."; &print_footer; } }

By doing this you are enclosing the calls to the email writing routines in the the code that is only executed if there is an item in the shopping cart.

Good luck.

-- Jeremy Wall (, May 11, 2000.

Moderation questions? read the FAQ