cancel
Showing results for 
Search instead for 
Did you mean: 

Follow original link after login

Follow original link after login

How can i set up magento to send the user to the page link they clicked after login.  I have it set up so users can only see the home page and static pages and to see the rest of the site they need to login.  The problem is when a user clicks a link from a newsletter or something that is supposed to go to a product it stops them at the login page.   Then  after login it puts them at the account page.   I have already turned off config - customer -customer configuration - login.  I have that set to No but it still dumps me at the account page and not the product page from the link.

Tags (1)
5 REPLIES

Re: Follow original link after login

Hi @tagteamc,

 

If you are trying to access to a private or user specific section you'll need to login (I'm not sure why you said that the user need to login to see a product URL).

Normally, changing this setting to "No":

 

Área de trabajo 1_001.pngLogin redirect options

Should be enough.

Can you debug which URL is the referer when you are redirected to login?

Maybe the referer url is the problem?


You can try to check here:

 

app/code/core/Mage/Customer/controllers/AccountController.php

Method:

 

public function loginPostAction()

 

 

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Follow original link after login

For your question

 

(I'm not sure why you said that the user need to login to see a product URL).

 

We have a site that is primarily for B2B and not random customers.  All of the businesses create an account and upon approval, they are assigned to a group that is allowed to login to see the products.   So if a new user comes to our site they can only see home page, about us page, faq page, etc.   Then if they want to become a distributor of our product they create an account and get assigned to a group that can log in and see all the products.

 

So, if we send a link out to customers that have an account to link them to a new product if they click it and follow it then it takes them to the login page.  After login it puts them at the account page and they don't know where the new product is.  If they go back and click the link it will work because they are logged in but that is annoying for a customer.

Re: Follow original link after login

Hi @tagteamc,

 

Iv'e said that becasue you first post said: "it stops them at the login page".

Now I understand a little bit more.

 

Which version of Magento are you using and how are you blocking the catalog for guest users?

 

If you set "System > Configuration > Customer Configuration > Login Options > Redirect Customer to Account Dashboard after Logging in" to "No", you should be fine (normally).

 

That's because the use of the next code in the core of Magento.

 

Mage::getSingleton('customer/session')->setBeforeAuthUrl($url)

Maybe you are using some cutomization that breaks that behavior?

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Follow original link after login

It is possible that there is some customization.  This template was not created  by me but another company.   

 

I have set Redirect to Dashboard to No and it still doesnt work so there must be some custom configuration.    Any idea how they would have done it?  I imagine it would have to be something that checks to see if there is an active session and the user is a part of the allowed group and if not, send them to the log in page.

Re: Follow original link after login

Well... I'm just guessing but maybe the implementation use an observer with the event:

 

<controller_action_predispatch>

There you can catch all requests and validate if the used is logged in or not and the allow the request or redirect.

I don't know, this is a possible approach but I should see the code to be sure.

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"