After a visitor has placed an item in thier cart and has to sign in or create a account, they go back to the index page and not to the shopping cart where they came from.
This first change means after your visitor logs in, if there are items in the cart, instead of going to the home page they go staight to checkout and get a message for displayed on checkout that they are logged in:
In login.php
find:
tep_redirect(tep_href_link(FILENAME_DEFAULT));
replace with:
if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, 'info_message=' . 'Welcome back, You have been logged in successfully!', 'SSL')); }
This next change means after your visitor completes the create account page if there are items in their cart, instead of going to CREATE_ACCOUNT_SUCCESS, they go staight to checkout and have a message displayed on checkout that the account is created:
In create account find:
tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
replace with:
if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, 'info_message=' . 'Welcome! Your new account has been successfully created!', 'SSL')); }
Another change I make is if your visitor has no items in thier cart & they click on checkout, they are taken to the login page, in my view this is not what they expect, so this change means if they click on checkout with nothing in thier cart they go to the cart.
in checkout_shipping.php:
find:
// 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));
move that section to above:
// 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'));
}
Thats it, hope you find this useful. [img]http://forums.oscommerce.com/public/style_emoticons/default/biggrin.gif[/img]










