Forums / General Questions / Login redirect modification?

Login redirect modification?

Started by skylab001 on 30 Apr 2012, 7:19 PM · Views: 4,867

Results 1 to 9 of 9
30 Apr 2012, 7:19 PM
#1
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

Login redirect modification?

I'm looking for a way to change the login redirect. As it works right now the user is redirected to the last page they visited before signing in if they were not in the process of checkout, I would like to change it so that the user is redirected to the home page after they signed in and were not in the process of checking out. If they were checking out then I'd like the process to remain the same.

I've followed some code to around line 145 of includes/modules/pages/login/header_php.php where it looks like this is happening but when I start changing things my site starts acting strange.

30 Apr 2012, 7:32 PM
#2
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

Re: Login redirect modification?

I should mention I thought the line:

} else {

	  zen_redirect(zen_href_link(FILENAME_DEFAULT, '', $request_type));

was supposed to redirect to the home page, but in reality you end up on your last viewed page?

2 May 2012, 10:00 PM
#3
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

Re: Login redirect modification?

I just can't seem to crack this one, my problem seems to be in his bit of code,

if (sizeof($_SESSION['navigation']->snapshot) > 0) {
        //    $back = sizeof($_SESSION['navigation']->path)-2;
        //if (isset($_SESSION['navigation']->path[$back]['page'])) {
        //    if (sizeof($_SESSION['navigation']->path)-2 > 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']);
        //            $origin_href = zen_back_link_only(true);
        $_SESSION['navigation']->clear_snapshot();


  	  zen_redirect($origin_href);

anytime I change this zen_redirect($origin_href); to redirect to the home page or other page, it does the redirect, but also messes with the checkout process which no longer works the same. my guess is the code for the $origin_href needs to be tweaked so it does not return to the last page viewed, but I haven't a clue as how to do that?

Can anybody advise?

3 May 2012, 7:08 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: Login redirect modification?

skylab001:

I'm looking for a way to change the login redirect.
The all-important question is: WHY? What specific business problem are you trying to solve by confusing your customers?

.
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.

3 May 2012, 9:23 PM
#5
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

Re: Login redirect modification?

DrByte:

What specific business problem are you trying to solve by confusing your customers?

I believe that by saying 'confusing the customer' your basing it on your personal opinion of how a store should operate. I only have a few products, all of which are listed on the home page, so if you are checking out, then logging in and being sent to checkout page 1 is perfect as it is. But If you are just logging in to log in, I think you should be redirected to the home page or the My account page, and not back to the last item viewed, and that seems to be how it works. That's how I see it at least.

4 May 2012, 2:30 AM
#6
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Login redirect modification?

skylab001:

I believe that by saying 'confusing the customer' your basing it on your personal opinion of how a store should operate.

I beleive that was a poor choice of words... A better statement would be "Are you trying to frustrate the customer?"

skylab001:

if you are checking out, then logging in and being sent to checkout page 1 is perfect as it is. But If you are just logging in to log in, I think you should be redirected to the home page or the My account page, and not back to the last item viewed, and that seems to be how it works. That's how I see it at least.

Back in the long dim dark past, many stores did work the way you would prefer, but most stores have evolved considerably and now work the same way that Zencart does, namely, after login it takes you back to the last product viewed. Many studies have indicated that the majority of people prefer this because it saves the hassle of having to relocate the item that they were looking to buy when they chose to log in.

Since most good stores now function in this manner, people have come to expect this behaviour, and as such, they tend to get very frustrated when they come across a store that does things in ways that they are not accustomed. I know it certainly frustrates me.

Sorry I can't help with what you are attempting to do. I don't know this part of the zencart code well enough to give a solution of the top of my head, and it isn't in my nature to go out of my way to help someone shoot themselves in the foot (metaphorically speaking).

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

4 May 2012, 4:51 AM
#7
drbyte avatar

drbyte

Sensei

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

Re: Login redirect modification?

skylab001:

I believe that by saying 'confusing the customer' your basing it on your personal opinion of how a store should operate.

...

But If you are just logging in to log in, I think you should be redirected to the home page or the My account page, and not back to the last item viewed, and that seems to be how it works. That's how I see it at least.And indeed, as you say, that is your opinion. I too wonder whether you're pushing yours upon your customers.
So, instead of arguing about it, I suggest:
Have you asked your customers if they really like being taken someplace other than where they were at when they clicked to log in?
If your customers are asked "is it okay to leave it like it is?" and they say yes, then that saves you a lot of trouble, doesn't it?
If you try to coach them into answering in such a way that proves your own preference, then of course you'll have more work to do as you troubleshoot your coding problem.

.
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.

4 May 2012, 7:55 PM
#8
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

Re: Login redirect modification?

It's not that I don't respect your opinions, I only have a few products, which are all on the index page. So when the user logs in and is returned to a product_info page that is unformatted, it's puzzling as to why they are on a page that looks nothing like the rest of the site.

That is the reason for needing to be redirected to the home page. I'm sorry, I was just asking for help. And yes I've talked to a handful of people testing the site for me that have mentioned this is a problem and suggested what I am asking.

4 May 2012, 10:36 PM
#9
drbyte avatar

drbyte

Sensei

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

Re: Login redirect modification?

skylab001:

I only have a few products, which are all on the index page. So when the user logs in and is returned to a product_info page that is unformatted
I don't follow. If your products are on the index page, that suggests to me that the customer is ON the index page. So when they click the Login link, they will indeed be returned back to the index page.
They would only be sent to the product page if they had actually clicked a link to go TO the product page in the first place.

.
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.