azpro Posted February 28, 2016 Share Posted February 28, 2016 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.