Just another WordPress.com weblog

To Authenticate user before product view

open : \app\code\core\Mage\Catalog\controllers\ProductController.php

in viewAction write this code ::

if (!Mage::getSingleton(‘customer/session’)->isLoggedIn())
{
$session = Mage::getSingleton(‘customer/session’);
$session->setBeforeAuthUrl(Mage::helper(‘core/url’)->getCurrentUrl()); /* set redirecting session  */

$this->_redirect(‘customer/account/login/’);  /* Here your login page url */
}

at line $session->setBeforeAuthUrl(Mage::helper(‘core/url’)->getCurrentUrl()); u can use your own redirect session

in $this->_redirect(‘customer/account/login/’); use your login page url

-Vishal Surani

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: