Hi Tracy, here is the code: (Thanks for your help so far)
<?php
/*
$Id: checkout_confirmation.php,v 1.139 2003/06/11 17:34:53 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
// avoid hack attempts during the checkout procedure by checking the internal cartID
if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
}
// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!tep_session_is_registered('shipping')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
if (!tep_session_is_registered('payment')) tep_session_register('payment');
if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];
if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}
//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons
//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons
//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons
// load the selected payment module
require(DIR_WS_CLASSES . 'payment.php');
$payment_modules = new payment($payment);
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
$payment_modules->update_status();
if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
}
if (is_array($payment_modules->modules)) {
$payment_modules->pre_confirmation_check();
}
//kgt - discount coupons
if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field
$order->coupon->verify_code();
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
} else {
if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session
tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page
}
}
} else { //if the coupon field is empty, unregister the coupon from the session
if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it
tep_session_unregister('coupon');
//now check to see if we need to recalculate shipping:
require_once( DIR_WS_CLASSES.'discount_coupon.php' );
if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
}
}
//end kgt - discount coupons
//kgt - discount coupons
if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field
$order->coupon->verify_code();
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
} else {
if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session
tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page
}
}
} else { //if the coupon field is empty, unregister the coupon from the session
if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it
tep_session_unregister('coupon');
//now check to see if we need to recalculate shipping:
require_once( DIR_WS_CLASSES.'discount_coupon.php' );
if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
}
}
//end kgt - discount coupons
//kgt - discount coupons
if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field
$order->coupon->verify_code();
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
} else {
if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session
tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page
}
}
} else { //if the coupon field is empty, unregister the coupon from the session
if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it
tep_session_unregister('coupon');
//now check to see if we need to recalculate shipping:
require_once( DIR_WS_CLASSES.'discount_coupon.php' );
if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
}
}
//end kgt - discount coupons
// load the selected shipping module
require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping($shipping);
require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
// Stock Check
$any_out_of_stock = false;
if (STOCK_CHECK == 'true') {
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
$any_out_of_stock = true;
}
}
// Out of Stock
if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
}
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>