Tag Archives: Magento add custom field in customer admin

Add extra field on customer address backend in magento

Step1: Create a file addCustomerColumn.php file in root directory
and put the below content in that file.


<?php

require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
 
$installer->addAttribute('customer_address', 'extra_field', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'Extra Field',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
    ->getAttribute('customer_address', 'extra_field')
    ->setData('used_in_forms', array('customer_register_address','customer_address_edit','adminhtml_customer_address'))
    ->save();
$installer->endSetup();

?>

Note: Change Extra filed name to your desire custom name.

Step2: Now run this file on your browser.

Step3: Clear your project cache.