Tuesday, 16 May 2017

How to Add Custom Field to Customer Address in magento



$installer = new Mage_Eav_Model_Entity_Setup('core_setup');

$installer->startSetup();

$installer->addAttribute('customer_address', 'specialdeliveryins', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'Special Delivery Instruction',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
    ->getAttribute('customer_address', 'specialdeliveryins')
    ->setData('used_in_forms', array('customer_register_address','customer_address_edit','adminhtml_customer_address'))
    ->save();
$installer->endSetup(); 

No comments:

Post a Comment