Merchant Stories

Customer Accounts: Getting Customers to Login

Feb 11, 2015 0 min read 386 views
Listen audio
Customer Accounts: Getting Customers to Login

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 extensions for Magento ®.

In order to configure such options you should login to your admin panel and go to System -> Configuration -> CUSTOMERS -> Customer Configuration -> Login Options. Set the value ‘No’ for a 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 experts who will be glad to assist you.

That's where you contact us!

    By submitting this form you agree to GoMage's Terms of Use and Privacy Policy
    woo-hoo! Now its time to keep checking your inbox, as we will be getting in touch soon. Promise :)
    oops! Thanks. But it seems like some kind of technical issues stop you from meeting GOMAGE. Could you try again?