public function preDispatch()
{
parent::preDispatch();

$redirect_url = Mage::getUrl(‘customer/account/login/’);
$current_url = Mage::helper(‘core/url’)->getCurrentUrl();
if( (!Mage::getSingleton(‘customer/session’)->isLoggedIn()) && ($current_url != $redirect_url)){
$beforeurl = Mage::getSingleton(‘customer/session’)->setBeforeAuthUrl(Mage::helper(‘core/url’)->getCurrentUrl());

MAGE::log($beforeurl ); /****first log*****/

$route = ‘customer/account/login’;
$url = Mage::getUrl($route);
Mage::app()->getResponse()->setRedirect($url);
}

}

Advertisements