Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

When customer signs in go to cart


KJ666

Recommended Posts

I have lost this i have seen it somwhere.

What i would like is when a customer signs in it takes them stright to there cart, not the home page.

 

Here is the code that manage the redirection in login.php

        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);
       } else {
         tep_redirect(tep_href_link(FILENAME_DEFAULT));
       }

 

You can change the FILENAME_DEFAULT (=index) to whatever you like.

 

I just wonder, what will happen if the customers cart is empty?

Link to comment
Share on other sites

WOuld somthing like this work ?

       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);
       } else {
 if ($cart->count_contents() < 1) {
         tep_redirect(tep_href_link(FILENAME_DEFAULT));
} else {
         tep_redirect(tep_href_link(FILENAME_CART));
 }
       }

 

Im not sure if you can have two else codes ??

anyone know ?

Link to comment
Share on other sites

Well i went a head and tested this: (got filename wrong in above post)

 

               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);
       } else {
 if ($cart->count_contents() < 1) {
         tep_redirect(tep_href_link(FILENAME_DEFAULT));
} else {
         tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }
       }

 

And so far it works a treat not found a problem yet (unless any of you see a problem with that code)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...