I have created a simple module that should add a custom attribute Display Name
to customers but when i add this to my site i get no attribute show up. The module is correctly setup and enabled
I've looked in the eav_attribute table in the database and theres no record of it. Cache has been flushed before and after
etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Namespace_Module>
<version>0.0.1</version>
</Namespace_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Namespace_Module</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
<connection>
<use>default_setup</use>
</connection>
</module_setup>
</resources>
</global>
</config>
sql/module_setup/mysql4-install-0.0.1.php
<?php
$installer = $this;
$installer->startSetup();
$customerEntityTypeId = $installer->getEntityTypeId('customer');
$atttributeCode = 'display_name';
$installer->removeAttribute($customerEntityTypeId, $atttributeCode );
$installer->addAttribute('customer', $atttributeCode, array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Display Name',
'global' => true,
'visible' => true,
'required' => false,
'user_defined' => true,
'visible_on_front' => true
));
$usedInCustomerAddressForms = array(
'adminhtml_customer',
'customer_account_edit'
);
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer', $attributeCode);
$attribute->setData('used_in_forms', $usedInCustomerAddressForms);
$attribute->save();
$this->endSetup();
eav_attribute
table?module_setup
incore_resource
tableeav_attribute
table there are no new entries for this (have also searched). Checking thecore_resource
table i can see thecustomerattribute_setup
entry (customer attribute is the actual name i just used module in my example above)core_resource
and try again. But make sure there is no other module with this alias for the setup.