I am on a site magento

I created a module to add an attribute in the customer account. At first it worked, my field has been added and then I realized that I had made a spelling mistake.

so I deleted directly attribute from phpmyadmin.

And when I relaunched the website I get this error when I go to customer management:

Fatal error: Call to a member function getBackend() on a non-object

I tried many things but I have found no solution.

Here are my files :

$installer = $this;


$this->addAttribute('customer', 'demande', array(
    'type' => 'int', // varchar, text, int, static, datetime
    'input' => 'boolean', // text, select, date
    'label' => 'Demande de compte professionnel',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'visible_on_front' => 1

 * Si attribut de type select :
 * 'type' => 'select',
 * 'source' => 'eav/entity_attribute_source_table',
 * 'option' => array('values' => array('Mon Option 1', 'Mon Option 2')),

    ->getAttribute('customer', 'demande')
    ->setData('used_in_forms', array('adminhtml_customer', 'customer_account_create', 'customer_account_edit', 'checkout_register'))


my config.xml file :




1 Answer 1


Your issue may have something to with used_in_forms keys didn't get deleted.

    ->getAttribute('customer', 'demande')
    ->setData('used_in_forms', array('adminhtml_customer', 'customer_account_create', 'customer_account_edit', 'checkout_register'))

Take a look at database table customer_form_attribute and compare it with a older backup

To remove attribute the correct way

/* @var $installer Mage_Eav_Model_Entity_Setup */
// Remove Product Attribute
$installer->removeAttribute('customer', 'product_attribute_code');

To fix your issue see Call to a member function getBackend() on a non-object

  • I mistake again. I tried the script also but it returns me a blank page. I do not know what to do
    – strauss
    Commented Feb 17, 2015 at 9:49
  • do you have a backup db to recreate the row you manually deleted? Commented Feb 17, 2015 at 14:49
  • my backups are created night and I create and delete the attribute in the day
    – strauss
    Commented Feb 17, 2015 at 14:51
  • I would try to create a new attribute (exactly the same except for the attribute code on a dev box). Then use it as a sample to recreate the row you manually deleted. Then try to delete both programmatically Commented Feb 17, 2015 at 14:56
  • it's just when I want to recreate an attribute that I come across this error.when i desactivate the module, I no longer have this error
    – strauss
    Commented Feb 17, 2015 at 15:03

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.