Search This Blog

Tuesday, October 18, 2011

magento create customer custom attribute throuogh sql or code

$installer = $this;

$installer->startSetup();

$connection = $installer->getConnection();

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$installer->removeAttribute('customer', 'name_goes_here');

$setup->addAttribute('customer', 'name_goes_here', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'name_goes_here',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$installer->endSetup();

$installer->installEntities();

use this in mysql4-upgrade-0.1.0-0.1.1.php or any latest sql folder script

No comments:

Post a Comment