//Get a singleton instance of the customer session model $customerSession = Mage::getSingleton('customer/session'); //Retrieve the customer ID from the session $customerId = $customerSession->getCustomerId(); //Retrieve customer data using the customer ID $customer = Mage::getModel('customer/customer')->load($customerId); //Output the customer's email address echo $customer->getEmail();
//Get a singleton instance of the core session model $coreSession = Mage::getSingleton('core/session'); //Set a value in the session $coreSession->setMyValue('Hello World!'); //Retrieve the value from the session $myValue = $coreSession->getMyValue(); //Output the value echo $myValue;In this example, we use `Mage::getSingleton('core/session')` to retrieve a single instance of the core session model. We then use this instance to set a value in the session, retrieve the value, and output it. Package Library: Magento Core Library