PRE-FINAL ORDER SUBMISSION CHECK PAGE
This hack generates a "Verify Information" page that presents customers with a listing of all of the information that they provided on the web_store order form. With this hack, customers are now able to verify the billing address, payment information, and shipping information that they provided on the order form BEFORE they actually submit their order. It also allows customers to verify the cart contents, subtotal, tax, shipping fees, and grand total.
If the information shown on the "Verify Information" page is correct, customers submit their order and are then presented with an "Order Confirmation" page which tells them that their order has been sent.
If the information shown on the "Verify Information" page is NOT correct, then they may return to the order form and correct the information.
To implement the code, just follow the 5 steps listed below. You may, of course, change the formats of the verification and confirmation pages to suit the style of your own web site.
- created by Danika Jackson
- Blueberry Bayou
- September 9, 1999
********************************************************************************
********************************************************************************
STEP #1:
Replace the code for the submit button in the outlet_order_form.html file with the following code:
*************
********************************************************************************
********************************************************************************
STEP #2:
This version of web_store uses form_data names that may not be used in YOUR version of web_store. So, you will first need to review the sc_order_form_array in YOUR version of the web_store.setup.html file. If the form_data names are different, then add, delete, or modify the form_data names in the code below as appropriate. Next, add the corrected code to the web_store_order_lib.pl file just above the process_order_form subroutine.
*************
# # # # # # # # # # # # # # # # # # # # # # # #
# subroutine: confirm_order
# # # # # # # # # # # # # # # # # # # # # # # #
sub confirm_order {
local($subtotal, $total_quantity,
$total_measured_quantity,
$text_of_cart,
$required_fields_filled_in);
local($hidden_fields)=&make_hidden_fields;
#
# First, we output the header of
# the processing of the order
#
print qq!
Verify Information
!;
} # End of confirm_order
############################################################
#
# subroutine: process_order_confirm
# Usage:
# &process_order_confirm()
# Output:
# The HTML for displaying the shipping, discount,
# and sales tax calculations for the cart. The ascii
# text version of this is returned appended to
# $text_of_cart.
# The $text_of_cart along with the form fields that
# the user submitted will be emailed and/or logged
# to a file depending on variables in the setup file.
#
############################################################
sub process_order_confirm {
local($subtotal, $total_quantity,
$total_measured_quantity,
$text_of_cart,
$required_fields_filled_in);
print qq!
Confirmation Page
!;
($subtotal,
$total_quantity,
$total_measured_quantity,
$text_of_cart) =
&display_cart_table("process order");
$text_of_cart =
&display_calculations($subtotal,"at",
$total_measured_quantity,$text_of_cart);
$required_fields_filled_in = "yes";
foreach $required_field (@sc_order_form_required_fields) {
if ($form_data{$required_field} eq "") {
$required_fields_filled_in = "no";
print "
You forgot to fill in " .
$sc_order_form_array{$required_field} . ".
\n";
}
} # End of checking required fields
print "\n";
# Since the required fields were
# filled in correctly, we process
# the rest of the order
#
#
if ($required_fields_filled_in eq "yes") {
# The $text_of_cart is appended with all
# the values for the form that the user
# has entered into the system.
#
foreach $form_field (sort(keys(%sc_order_form_array))) {
$text_of_cart .=
&format_text_field($sc_order_form_array{$form_field})
. "= $form_data{$form_field}\n";
}
$text_of_cart .= "\n";
#
# If PGP (Pretty Good Privacy) is in
# use, then we translate the text of the
# cart to a PGP encrypted form using
# the pgp-lib.pl file that we provided
# with the web_store.
#
if ($sc_use_pgp =~ /yes/i) {
&require_supporting_libraries(__FILE__, __LINE__,
"$sc_pgp_lib_path");
$text_of_cart = &make_pgp_file($text_of_cart,
"$sc_pgp_temp_file_path/$$.pgp");
$text_of_cart = "\n" . $text_of_cart . "\n";
}
if ($sc_send_order_to_email =~ /yes/i) {
&send_mail($sc_order_email,$sc_order_email,
"Web Store Order", $text_of_cart);
}
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);
}
print "
Your Order Has Been Sent!
\n";
} else {
# The user is notified if the order
# was not a success (not all required
# fields were filled in).
#
print "
Your Order Has Not Been Sent!
\n";
}
# The footer is printed
print "\n";
print qq!