Magento Certified Developer GuideCategory: 10. CustomersHow can attributes be added to a customer address? How are custom address attributes you added converted to an order address
Manish Prakash Staff asked 2 years ago

This the way to add a new customer attribute

$setup = Mage::getModel('customer/entity_setup');
$setup->addAttribute('customer', 'school', array(
    'type' => 'int',
    'input' => 'select',
    'label' => 'School',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'default' => '0',
    'visible_on_front' => 1,
        'source' => 'profile/entity_school',
));
Mage::getSingleton('eav/config')
    ->getAttribute('customer', 'school')
    ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
    ->save();

To transfer attribute to order need to define in config.xml
global -> fieldset -> sales_convert_order_address