Authentication before product view

0
16
views
Advertisement

To Authenticate user before product view

open : appcodecoreMageCatalogcontrollersProductController.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

-Mayank Zalavadia