How to load a customer with an eav attribute ?

I created a new eav attribute with that :

$attribute  = array(
        'type'          => 'varchar',
        'input'         => 'text',
        'label'         => 'My Field',
        'global'        => true,
        'visible'       => true,
        'default'       => '',
        'required'      => false,
        'user_defined'  => 0,
        'used_in_forms' => array(
$installer->addAttribute('customer', 'my_field', $attribute);

And now, I want to load customer, but the following code doesn't work :

$customer = Mage::getModel('customer/customer');
$customer->load($myField, 'my_field');

But if I load the customer with email (for example), after, I can get 'my_field' value with :


Any idea ?

1 Answer 1


Try to use This

$result = Mage::getModel('customer/customer')

if (is_object($result)) {
    /* Logic */

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.