Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

m3hd1

Pioneers
  • Posts

    10
  • Joined

  • Last visited

Posts posted by m3hd1

  1. What I do know, is it has something to do with the way the session id is being handled. What I don't know is which page to troubleshoot. My first thought is checkout_confirmation.php What do you have on that page above this bit of code:

    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    

     

    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>

  2. Does the error message show up after they are redirected to login?

     

    Can you post the code on your checkout_payment.php page - everything above the </head><body> tags?

     

    Hi Tracys, this bug happens every time when the end user enters the wrong coupon code. Does not make any difference if they have already logged in or not. The site url is www.365lingerie.com - feel free to place a dummy order and enter a random coupon code and you will see the bug ... you will be asked to login again even though if you already have logged in ...

     

     

    Here is the code:

    -------------------

     

    <?php

    /*

    $Id: checkout_payment.php,v 1.113 2003/06/29 23:03:27 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();

    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));

    }

     

    // 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'));

    }

     

    // 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'));

    }

    }

     

    // Stock Check

    if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {

    $products = $cart->get_products();

    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

    if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {

    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

    break;

    }

    }

    }

     

    // if no billing destination address was selected, use the customers own address as default

    if (!tep_session_is_registered('billto')) {

    tep_session_register('billto');

    $billto = $customer_default_address_id;

    } else {

    // verify the selected billing address

    $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");

    $check_address = tep_db_fetch_array($check_address_query);

     

    if ($check_address['total'] != '1') {

    $billto = $customer_default_address_id;

    if (tep_session_is_registered('payment')) tep_session_unregister('payment');

    }

    }

     

    require(DIR_WS_CLASSES . 'order.php');

    $order = new order;

     

    if (!tep_session_is_registered('comments')) tep_session_register('comments');

     

    $total_weight = $cart->show_weight();

    $total_count = $cart->count_contents();

     

    // load all enabled payment modules

    require(DIR_WS_CLASSES . 'payment.php');

    $payment_modules = new payment;

     

    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

     

    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

    ?>

    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html <?php echo HTML_PARAMS; ?>>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

    <?php

    # cDynamic Meta Tags

    /*<title><?php echo TITLE; ?>*/

    require(DIR_WS_INCLUDES . 'meta_tags.php');

    #

    ?>

    <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

    <link rel="stylesheet" type="text/css" href="stylesheet.css"><LINK REL="SHORTCUT ICON" HREF="/favicon.ico">

    <script language="javascript"><!--

    var selected;

     

    function selectRowEffect(object, buttonSelect) {

    if (!selected) {

    if (document.getElementById) {

    selected = document.getElementById('defaultSelected');

    } else {

    selected = document.all['defaultSelected'];

    }

    }

     

    if (selected) selected.className = 'moduleRow';

    object.className = 'moduleRowSelected';

    selected = object;

     

    // one button is not an array

    if (document.checkout_payment.payment[0]) {

    document.checkout_payment.payment[buttonSelect].checked=true;

    } else {

    document.checkout_payment.payment.checked=true;

    }

    }

     

    function rowOverEffect(object) {

    if (object.className == 'moduleRow') object.className = 'moduleRowOver';

    }

     

    function rowOutEffect(object) {

    if (object.className == 'moduleRowOver') object.className = 'moduleRow';

    }

     

    function popupWindow(url) {

    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=500,screenX=150,screenY=30,top=30,left=150')

    }

    //--></script>

    <?php echo $payment_modules->javascript_validation(); ?>

    </head>

  3. Hi, I have an oscommerce ms 2.2 e-commerce site - I have used the AutoInstaller 2.14 for Discount Coupon Codes and have installed the Discount Coupon Codes v 3.32 - Everything seems to work okay, however I have discovered that if during the order process (Payment Information - checkout_payment.php), if customers types in an incorrect Coupon Code in the box, after clicking on Continue, they will be taken to the login page (login.php) - this is like a loop process. However if they type in the right coupon code, everything works fine and the discount is applied ... Any idea what is causing this?

     

    I'm running PHP 5.2.6 - MySQL 4.1.22-standard

     

    Thanks for your help in advance.

     

    P.S. what would be the latest / correct version of Discount Coupon Codes to use for an oscommerce ms 2.2 shopping cart? is version v 3.32 correct?

     

    Thanks.

  4. Hi, I have an oscommerce ms 2.2 e-commerce site - I have used the AutoInstaller 2.14 for Discount Coupon Codes and have installed the Discount Coupon Codes v 3.32 - Everything seems to work okay, however I have discovered that if during the order process (Payment Information - checkout_payment.php), if customers types in an incorrect Coupon Code in the box, after clicking on Continue, they will be taken to the login page (login.php) - this is like a loop process. However if they type in the right coupon code, everything works fine and the discount is applied ... Any idea what is causing this?

     

    I'm running PHP 5.2.6 - MySQL 4.1.22-standard

     

    Thanks for your help in advance.

     

    P.S. what would be the latest / correct version of Discount Coupon Codes to use for an oscommerce ms 2.2 shopping cart? is version v 3.32 correct?

     

    Thanks.

×
×
  • Create New...