Need help buying now? +48-22-219-5163 +1-917-720-3250
My Cart

Your Cart is Empty

Need help buying now?
+48-22-219-5163 +1-917-720-3250

Redirection to account login page and back

Redirection to account login page and back

One of the parameters an online store sales level depends on is how simple the ordering process is. For security reasons, some online stores allow making orders for registered customers only. How can we make a user stay on the product page which they wish to order after they login or register on your site? Such configuration is possible in Magento backend without any additional Magento extensions.

In order to configure such option you should login to your admin panel and go to System -> Configuration -> CUSTOMERS -> Customer Configuration -> Login Options. Set the value ‘No’ for redirect. The option will look as follows:

Redirect Customers to Account Dashboard after Logging in = No

 

You can also use these options to allow specific pages be viewed by registered users only. First, you need to send a user to a login page with the help of login.phtml file:

if(!Mage::helper('customer')->isLoggedIn()) {
	Mage::getSingleton('customer/session')
            ->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl());
	$this->_redirect('customer/account/login');
}

 

And then send them back to the page where they were:

if(!Mage::helper('customer')->isLoggedIn()) {
	Mage::getSingleton('customer/session')
            ->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl());
	echo '<p>Please <a href="'.Mage::getUrl('customer/account/login').'">Login</a> 
to view the page.</p>';
}

 

Save the changes in the file and check the functionality. If you have any questions or need assistance please feel free to contact our GoMage Magento experts who will be glad to assist you.

Newsletter