Jump to content
Latest News: (loading..)
Sign in to follow this  
azpro

2.3.4 BS EDGE login.php

Recommended Posts

Yes ... I am going through the last stages of my new BS site so I am working my way through some annoying issues for customers.

 

I see a lot of customers using the back-button of their browser - clearly even more on iPads and other mobile devices. This gives an IMHO undesired effect for login.php if a customer is already logged on.

 

Scanario:

Not logged in Customer adds product to cart - clicks Checkout - will be redirected to login.php - will either create an account or login - will be redirected to checkout_shipping.php (through $navigation->snapshot) ... now maybe goes to checkout_payment.php .... Then thinks what was in my cart (or whatever customers think - really dono sometimes :) ) and push the Back-button of browser and again push the Back-button... They will come again to login.php while they are allready logged in ... Gives confusion .... And that's never a good thing.

 

So what i did:

In checkout_shipping.php after

// 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, 'action=login', 'SSL'));
  }

I added:

  // Added snapshot to redirect logged in customers wich use back button
  if (tep_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
  }

In shopping_cart.php after

 require("includes/application_top.php");

I added:

  // Added snapshot to redirect logged in customers wich use back button
  if (tep_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
  }

in login.php after

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
  if ($session_started == false) {
    if ( !isset($_GET['cookie_test']) ) {
      $all_get = tep_get_all_get_params();

      tep_redirect(tep_href_link('login.php', $all_get . (empty($all_get) ? '' : '&') . 'cookie_test=1', 'SSL'));
    }

    tep_redirect(tep_href_link('cookie_usage.php'));
  }

I added

// redirect a logged in customer if used the back button
  if (tep_session_is_registered('customer_id')) { // allready logged in customer is logging in
    if (sizeof($navigation->snapshot) > 0) {
      $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
      $navigation->clear_snapshot();
      tep_redirect($origin_href);
    }
    tep_redirect(tep_href_link('index.php'));
  }

Again ... Feedback appreciated!

 

Regards

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×