Forums / Templates, Stylesheets, Page Layout / Redirect after login is wrong how do I change it?

Redirect after login is wrong how do I change it?

Locked

Views: 2,000

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
9 Jul 2009, 5:21 PM
#1
touchclothing avatar

touchclothing

Totally Zenned

Join Date:
Jul 2005
Location:
Brooklyn NY
Posts:
498
Plugin Contributions:
0

Redirect after login is wrong how do I change it?

when I add something to the cart and then go to check out and it asks me to log in after I login it takes me to the front page not to the check out how can I fix that? It does the same thing when I create an account.

here is the codes I found.
/includes/modules/pages/login/header_php.php

$sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
              SET customers_info_date_of_last_logon = now(),
                  customers_info_number_of_logons = customers_info_number_of_logons+1
              WHERE customers_info_id = :customersID";

      $sql = $db->bindVars($sql, ':customersID',  $_SESSION['customer_id'], 'integer');
      $db->Execute($sql);
      $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS');

      // restore cart contents
      $_SESSION['cart']->restore_contents();
      /*
      if ($_SESSION['cart']->count_contents() > 0) {
      zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING));
      }

/includes/modules/pages/create_account_success/header_php.php

if (sizeof($_SESSION['navigation']->snapshot) > 0) {
  $origin_href = zen_href_link($_SESSION['navigation']->snapshot['page'], zen_array_to_string($_SESSION['navigation']->snapshot['get'], array(zen_session_name())), $_SESSION['navigation']->snapshot['mode']);
  $_SESSION['navigation']->clear_snapshot();
} else {
  $origin_href = zen_href_link(FILENAME_DEFAULT);
}

// redirect customer to where they came from if their cart is not empty and they didn't click on create-account specifically
if ($_SESSION['cart']->count_contents() > 0) {
  if ($origin_href != zen_href_link(FILENAME_DEFAULT)) {
    zen_redirect($origin_href);
  }
}
13 Jul 2009, 5:40 PM
#2
touchclothing avatar

touchclothing

Totally Zenned

Join Date:
Jul 2005
Location:
Brooklyn NY
Posts:
498
Plugin Contributions:
0

Re: Redirect after login is wrong how do I change it?

any ideas?

13 Jul 2009, 7:13 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Redirect after login is wrong how do I change it?

touchclothing:

when I add something to the cart and then go to check out and it asks me to log in after I login it takes me to the front page not to the check out how can I fix that? It does the same thing when I create an account.
That's not how a brand new uncustomized clean install works.
Normally if it redirects you to login as part of checkout, it takes you right back to the checkout page you were expecting once you've logged in.

Perhaps you have one or more addons or code customizations that are breaking the default behavior.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 Jul 2009, 8:22 PM
#4
touchclothing avatar

touchclothing

Totally Zenned

Join Date:
Jul 2005
Location:
Brooklyn NY
Posts:
498
Plugin Contributions:
0

Re: Redirect after login is wrong how do I change it?

I did not build the site. I am just trying to help some out.

5 Oct 2009, 8:11 PM
#5
jlazzarino avatar

jlazzarino

New Zenner

Join Date:
Aug 2009
Posts:
9
Plugin Contributions:
0

Re: Redirect after login is wrong how do I change it?

I'm building our store using ZC version 1.3.8....my partner and I are creating our own custom template.

If we wanted the login to redirect to an alternatve page, say an EZPage what code would need to be changed to do it?

I was thinking that I could simply update the redirect variable being used in the login.php code to replace the FILENAME_DEFAULT with FILENAME_EZPAGES and specify the page number?

any better ideas?

5 Oct 2009, 9:20 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Redirect after login is wrong how do I change it?

That sounds right. What happened when you did that?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Nov 2009, 6:07 AM
#7
jlazzarino avatar

jlazzarino

New Zenner

Join Date:
Aug 2009
Posts:
9
Plugin Contributions:
0

Re: Redirect after login is wrong how do I change it?

sorry about the delayed response...I was away and I haven't found a way to get notified of responses?

I couldn't figure out what page and exactly what to edit. After all FILENAME_DEFAULT is used 1100 times so how do I know which login is for the store and which is for the Admin console?

any suggestions would be appreciated.

thanks in advance.

Jon

9 Nov 2009, 5:02 PM
#8
thieving_gypsy avatar

thieving_gypsy

New Zenner

Join Date:
May 2006
Posts:
87
Plugin Contributions:
0

Re: Redirect after login is wrong how do I change it?

I've had this problem a couple of times recently - I've found that setting Recrete Session to false in Config > Sessions gets rid of the problem most of the time (it's happened on several sites), but not always.

I think the problem has to do with the users session as I don;t think the $_SESSION['navigation'] variable is being setup/accessed correctly.

Does this give anyone any pointers or ring any bells?

Thanks

Andy

10 Nov 2009, 6:08 PM
#9
lackew avatar

lackew

Zen Follower

Join Date:
Aug 2009
Location:
Tampa Bay
Posts:
223
Plugin Contributions:
1

Re: Redirect after login is wrong how do I change it?

this is what is happening with mine from the begining of a clean install (thought it is default set-up) and been searching posts in forum to redirect back to shopping cart or last viewed product page instead of main page.

blessed be the day we make tomorrow a better yesterday