cancel
Showing results for 
Search instead for 
Did you mean: 

Get protected data from customer in a observer

Get protected data from customer in a observer

Hi,

 

I tried to get the information about a logged customer into an observer, but I can't get it even when I get the customer object and maybe it's because I have the "protected" data

 

In the Observer file:

$observer->getEvent()->getCustomer(); // works
DEBUG (7): Mage_Customer_Model_Customer Object
(
    [_eventPrefix:protected] => customer
    [_eventObject:protected] => customer
    [_errors:protected] => Array
        (
        )

    [...]
    [_isObjectNew:protected] => 
    [_data:protected] => Array
        (
            [website_id] => 1
            [entity_id] => 2

--------------------------------------------
$observer->getEvent()->getCustomer()->getData();
// Call to a member function getData() on null

How can I get the customer data?

1 REPLY 1

Re: Get protected data from customer in a observer

I don't understand why, but with this works:

            if ($customer) {
                $customer->getData();
            }

Can anyone explain it?