Question

I have made a custom module in which I have an observer file. I need to display all information about the logged in user.

Was it helpful?

Solution

Use the event customer_login:

<customer_login>
    <observers>
        <yourobservername>
            <type>model</type>
            <class>yourmodule/path_to_class</class>
            <method>customerLogin</method>
        </yourobservername>
    </observers>
</customer_login>

Your observer class would look like this:

class YourCompany_YourModule_Model_Observer
{
    public function customerLogin($observer)
    {
        $customer = $observer->getCustomer();
    }
}

OTHER TIPS

Try This

    if($customer = Mage::getSingleton('customer/session')->isLoggedIn()) {
$customer =  Mage::getSingleton('customer/session')->getCustomer();
       $customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
       //for firstname
       $customerFirstName = $customerData['firstname'];
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top