I am developing custom module which needs to use customer data from session. Here I am having some problem with session. I am unable to get any customer data in my custom module from session even if the user logged in.
I logged below code in my index controller.
Mage::getSingleton('core/session', array('name' => 'frontend'));
$customer_id = Mage::getSingleton('customer/session')->getCustomer()->getId();
Mage::log("Index - customer id check: " . $customer_id);
A failure to get customer Id.
After that added customer_login event and tried to log the same in the observer method. Here it worked.
But, still not working in the index controller.
Please help
Best Answer
You need to check customer is
loggedin or not
.Without
customer loggin
,you cannot getcustomer data from session
: