I want to redirect the user to login page on landing, While user is not logged in.
for example :-
example.com ->(not logged in)-> redirect to login page.
example.com ->(logged in)-> redirect to Home page.
How can i do this ?
I was found some function like this
public function preDispatch()
{
parent::preDispatch();
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
$this->setFlag('', 'no-dispatch', true);
}
}
How can i use or where should i use this.
Hope some will have experience on this. Thanks in advance
This one save is me,
if(!$this->helper('customer')->isLoggedIn()){
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
}
And i called it in cms page block.Hope this help someone.