سؤال

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

هل كانت مفيدة؟

المحلول

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();
    }
}

نصائح أخرى

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'];
    }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top