I am on a site magento 1.7.0.2
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; $installer->startSetup(); $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')), */ Mage::getSingleton('eav/config') ->getAttribute('customer', 'demande') ->setData('used_in_forms', array('adminhtml_customer', 'customer_account_create', 'customer_account_edit', 'checkout_register')) ->save(); $installer->endSetup();
my config.xml file :
<admin>
<routers>
<customfield>
<use>admin</use>
<args>
<module>Digitgold_Demande</module>
<frontName>customfield</frontName>
</args>
</customfield>
</routers>
</admin>
<global>
<fieldsets>
<customer_account>
<demande><create>1</create><update>1</update><name>1</name></demande>
</customer_account>
</fieldsets>
</global>
<global>
<resources>
<customfield_setup>
<setup>
<module>Digitgold_Customer</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</customfield_setup>
<customfield_write>
<connection>
<use>core_write</use>
</connection>
</customfield_write>
<customfield_read>
<connection>
<use>core_read</use>
</connection>
</customfield_read>
</resources>
</global>
thanks