Sunday, 20 November 2011

Getting Customer session in Magento

Customer session can be got in Magento by below code:

$session = Mage::getSingleton('customer/session');
$customer = $session->getCustomer();
$customer->getEmail();
if ($session->isLoggedIn() )
{
//Do whatever you wish after the customer login
// Redirection code
Mage::app()->getFrontController()->getResponse()->setRedirect($this->getUrl('login_required'));
}

1 comment :

  1. I really enjoy examining on this website , it contains wonderful posts . "Something unpredictable but in the end it's right, I hope you have the time of your life." by Greenday.

    ReplyDelete