I am having some trouble with the redirection in this contribution.
Issue #1:
If they already have an account and use the login box to login, they are taken to the (DEFAULT) index.php page.
Issue #2:
If they do not have an account and fill out the information but opt-out of creating an account and click continue, they are taken to checkout_shipping which is combined with checkout_payment (They now have an "Account" and there is an option for Log Off and Create Account). If for whatever reason (ie. decide to change their billing/shipping info), they click the back button on the browser, they are taken to account_password_new.php and are forced to enter a password instead of taking them to a page where they can edit their info.
Here is the first part of my create_account.php
<?php
/*
$Id: create+account3.php,v 2.00 2004/01/05 23:28:24 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
$show_account_box = 1;
//0 no create account box
//1 javascript create account box
//2 normal create account box
$create_password =0;// set to 1 to create an account with random password
$show_login=1;
//0 no create login box
//1 javascript login account box
//2 normal create login box
////////////////////////////////////////////////
////////////////////////////////////////////////
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . 'create_account.php');
require(DIR_WS_LANGUAGES . $language . '/' . 'fast_account.php');
require(DIR_WS_LANGUAGES . $language . '/' . 'login.php');
// if we have been here before and are coming back get rid of the credit covers variable
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers'); //rmh M-S_ccgv
//line 21-23 sends the customer ti index.php if he is logedin
if ((tep_session_is_registered('customer_id'))&&(tep_session_is_registered('createaccount'))) { tep_redirect(tep_href_link('account_password_new.php', '', 'SSL'));
}
if (tep_session_is_registered('customer_id')) {
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'SSL'));
}
// 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) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
}
$error = false;
if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
$fromlogin=tep_db_prepare_input($HTTP_POST_VARS['fromlogin']);
if (ACCOUNT_GENDER == 'true') {
if (isset($HTTP_POST_VARS['gender'])) {
$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
} else {
$gender = false;
}
}
//START REGISTRATION CODE
//$createaccount='N';
//next two lines gives you a temporary fixed password you can change to what you like
//start type one create assount
if ($create_password == 1) {
$createaccount = tep_db_prepare_input($HTTP_POST_VARS['createmyaccount']);
if ($createaccount!='Y')$createaccount='N';
$password = tep_create_random_value(15);
$confirmation = $password;
}
//start type two create account
if ($show_account_box >= 1) {
$createaccount = tep_db_prepare_input($HTTP_POST_VARS['createaccount']);
if ($createaccount!='Y')$createaccount='N';
if ($createaccount=='Y') {
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);
}
}
if ($fromlogin == 1) {
$createaccount = 'Y';
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);
}
$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
$city = tep_db_prepare_input($HTTP_POST_VARS['City']);
if (ACCOUNT_STATE == 'true') {
$state = tep_db_prepare_input($HTTP_POST_VARS['state']);
if (isset($HTTP_POST_VARS['zone_id'])) {
$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
} else {
$zone_id = false;
}
}
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);
if (isset($HTTP_POST_VARS['newsletter'])) {
$newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
} else {
$newsletter = false;
}
I know it has to do with the redirection part of it:
//line 21-23 sends the customer ti index.php if he is logedin
if ((tep_session_is_registered('customer_id'))&&(tep_session_is_registered('createaccount'))) { tep_redirect(tep_href_link('account_password_new.php', '', 'SSL'));
}
if (tep_session_is_registered('customer_id')) {
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'SSL'));
}
I just don't want to change this and cause problems with the way these redirections were intended to be used.
Any help is greatly appreciated as this is causing some confusion with my customers and I have been receiving several complaints about getting "lost"