Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Take Visitor to Checkout instead of Home Page after login/create account


spooks

Recommended Posts

 

In login.php

 

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

 

I added this code however, I changed it to FILENAME_SHOPPING_CART instead of FILENAME_CHECKOUT_SHIPPING and it works great as long as the item added is in the member's cart from previous log-in. Welcome message also displays correctly.

 

If there is an item added to the visitor's cart before log-in it always redirects to checkout_shipping.php after the visitor/member cart merge even if there was no item in the members cart from a previous log-in. In this case, the welcome message is also not displayed.

 

Where can I find the "cart merge" code that I assume has a redirect? I would like to use this code above to force log-ins with visitor cart contents >0 to the shopping cart as well.

 

The issue I see is that a customer (forgetting that they previously added to their member's cart) will be confused when they arrive to the shipping page and they see shipping at a cost greater then the item(s) they just added to the visitor cart. They then wouldn't see the additional items in their now merged cart until they reach the confirm page unless they click out of the checkout process. Neither my shipping or payment pages show cart contents, quantities or item prices.

Link to comment
Share on other sites

After re-reading the first post in this thread and going thru my checkout process a couple more times I'm gonna try and reword it a little.

 

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.

 

My setup never directed you to the index page or back to the shopping cart after being forced to log in. It sent you on to where the button you click in the shopping cart to check out would have sent you had you been logged in, checkout_shipping.php. If you clicked the button and then had to create an account it would then send you to the account confirmation page where you would click continue and then you were finally directed to the index page.

 

My code in the login.php was the same.

tep_redirect(tep_href_link(FILENAME_DEFAULT));

 

By replacing with this:

if ($cart->count_contents() < 1) {	tep_redirect(tep_href_link(FILENAME_DEFAULT));   } else {   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'info_message=' . 'Welcome back, You have been logged in successfully!', 'SSL'));   }

 

it allowed for the user to see their updated cart after the visitor's and member's carts merge at log-in but it only works if your using the login.php button. Using the "Checkout" button (checkout_shipping.php) in either cart always either takes you directly or redirects you after log-in to the shipping page no matter what you had in either cart or how you change the code in login.php.

 

In fact, if your not logged in there is no checkout button anywhere until you add something to your cart so there is no need or anything fixed by the 3'rd change on this post unless I'm missing something. If somehow someone ended up on checkout with nothing in their cart wouldn't it automatically show empty cart?

 

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

 

I need something like this that says if checkout_shipping.php is clicked while in cart and user is not logged in redirect back to cart after log-in. Instead somewhere it's saying to continue on to shipping after log-in and i don't see anything like that in the login.php file.

 

By reading what others have asked it looks like many have had the same issues but I didn't find anyone asking it exactly. So far the closest solution I found was to have it clear the member's cart feature after log-out so there wouldn't be a hidden merge with no chance to review the updated cart before you land on checkout_shipping.

 

Another solution would be if I could figure out how to show cart totals with an edit button on the shipping page like it does on the confirmation page and then cart and shipping on the payment page. Ideally if each page thru the checkout process would stack on the previous page's info all the way to the confirmation page it would make it a lot more user friendly for the consumer.

Link to comment
Share on other sites

Using the "Checkout" button (checkout_shipping.php) in either cart always either takes you directly or redirects you after log-in to the shipping page no matter what you had in either cart or how you change the code in login.php.

 

In fact, if your not logged in there is no checkout button anywhere until you add something to your cart so there is no need or anything fixed by the 3'rd change on this post unless I'm missing something. If somehow someone ended up on checkout with nothing in their cart wouldn't it automatically show empty cart?

 

 

I need something like this that says if checkout_shipping.php is clicked while in cart and user is not logged in redirect back to cart after log-in. Instead somewhere it's saying to continue on to shipping after log-in and i don't see anything like that in the login.php file.

 

 

If you look in the default version of checkout_shipping.php, you would have this code:

// 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 customer is not logged in it will take them to login.php and then shopping cart if nothing in basket. Take a look at what you have in checkout_shipping which is making it behave the way you describe.

 

If you don't have the checkout button when cart is empty, it seems like you have a modification installed. I think "More Logical Checkout" hid the "checkout" link, might be worth a look. I personally didn't like that little bit as I felt the customer may have saved their basket previously and want to click "checkout" so I didn't use that part of code. I think I used "Faster Checkout" which removes "checkout success" redundant page if items in cart.

 

There are a lot of tweaks but you have to find one that suits you and that may involve combining different contributions. There is a mod that alters checkout to show shopping cart during checkout, could be "2 step checkout" not sure though.

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

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

PM me? - I'm not for hire

Link to comment
Share on other sites

Thanks tigergirl, my version of checkout_shipping.php was the same which led to to compare the code in Checkout_process which was the same example from this post but it had extra code using snapshot to redirect after log in. I added it to my checkout_shipping and chose to send people back to their cart after the merge of the two carts.

 

I used

// 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_SHOPPING_CART));
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 

If you don't have the checkout button when cart is empty, it seems like you have a modification installed. I think "More Logical Checkout" hid the "checkout" link, might be worth a look.

 

It looks like the buy now button has been used as an add to cart button unless default has both and my buy now/checkout button has been disabled. I like that there isn't a checkout button without something in your cart but I might consider adding a view cart button on my product pages. I haven't searched for tips on that yet.

 

There are a lot of tweaks but you have to find one that suits you and that may involve combining different contributions. There is a mod that alters checkout to show shopping cart during checkout, could be "2 step checkout" not sure though.

Now that my redirect is working I'll check into this. It would be nice to show each step of checkout build up as you go thru the process.

 

Thanks again, I appreciate the help.

Link to comment
Share on other sites

  • 1 month later...

This came up & others may find it useful, so I`m repeating the tip here:

 

These tips were utterly brilliant in their use and simplicity. Thank you so much Sam. I incorporated all of them into our online store with absolutely zero problems.

 

Boom

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Hey :)

 

Works perfect, thank you!

 

I tried to modify the code a little bit to adapt the info_message, since my store is in french and english... but no success as I am a php newbie :P

 

Can someone give me a little help plz?

Link to comment
Share on other sites

Related to

 

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

 

 

For me it doesn't work, could you please check my code (I changed checkout_shipping to shopping_cart) but the user is not directed to the cart page after login if he has something in his cart.

 

Secondly: How do you handle the textmessages if you have a multilanguage site?

 

Code

 

} else {

if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } else { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'info_message=' . 'Welkom terug, U bent opnieuw ingelogd en kan uw bestelling verder afwerken indien u wenst!', 'SSL')); }

 

}

}

}

}

 

if ((isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process'))

Link to comment
Share on other sites

@Krikie

 

I have finally been able to adapt the info_message, to show it in french or in english. Here is the guideline (included your modification to redirect to shopping_cart instead of checkout shipping)

 

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_SHOPPING_CART, 'info_message=' . WELCOME_TEXT, 'SSL'));   }

 

In includes/languages/english.php, insert the following line before the ending ?>

 

define('WELCOME_TEXT', 'Welcome back, You have been logged in successfully!');

 

In includes/languages/nederlands.php I guess, or whatever your other language name, also define WELCOME_TEXT by putting before the ending ?>

 

define('WELCOME_TEXT', 'Welkom terug, U bent opnieuw ingelogd en kan uw bestelling verder afwerken indien u wenst!');

 

Enjoy ;)

Link to comment
Share on other sites

  • 5 months later...

Thanks Sam for the basic tip.

 

I needed the info msg in different language as well as English and like ThomasG managed that tweak, BUT... discovered that any punctuation or accented letters would not display (no ',' or '!' in English version and no 'é' etc even when using 'é').

 

Also, any way of adjusting the text formatting or background colour?

 

Thanks,

Mike

Link to comment
Share on other sites

  • 1 month later...

I hope some help can be given here

 

I tried to make the changes to the login and i now know that i editted the wrong text instead of editting and replacing the below,

find:

tep_redirect(tep_href_link(FILENAME_DEFAULT));

I editted a line that i am sure contained the word cookies - now when a customer who is not logged in goes to the checkout i get an ssl error on the internet connection

reading

Secure Connection Failed

 

 

 

 

 

 

 

An error occurred during a connection to crosscommsdistribution.co.uk.

 

SSL received a record that exceeded the maximum permissible length.

 

(Error code: ssl_error_rx_record_too_long)

 

 

 

 

 

 

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.

Please contact the web site owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.

 

The file currently reads this

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

}

 

Can anyone please help me get this line back to what it was before i messed it up.

 

Thank you

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...