Thanks for the response Alex.
The coupon mod I'm using is Discount Coupon Codes 3.32 /dynamoeffects (
http://www.oscommerce.com/community/contributions,4269). I've already made the following changes to ajaxManagerTest.class.php:
ADDED:
//kgt - discount coupons
if( tep_session_is_registered( 'coupon' ) && is_object( $order->coupon ) ) {
$sql_data_array = array( 'coupons_id' => $order->coupon->coupon['coupons_id'],
'orders_id' => $insert_id );
tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );
}
//end kgt - discount coupons
AFTER:
$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
$sql_data_array = array('orders_id' => $insert_id,
'orders_status_id' => $order->info['order_status'],
'date_added' => 'now()',
'customer_notified' => $customer_notification,
'comments' => $order->info['comments']);
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
AND ADDED:
//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
AFTER:
if (is_array($payment_modules->modules)) {
AND ADDED:
//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
AFTER:
function _showPayment($get) {
AND ADDED:
/* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main">
<?php echo TABLE_HEADING_COUPON; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="7"'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
/* end kgt - discount coupons */
?>
below the PAYMENT ADDRESS
*I'm using the latest version of oscommerce. Any help would be greatly appreciated!