I want to add multiple fields in registration form.
installation file is:-
<?php
$installer = $this;
$installer->startSetup();
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'accounttype', array(
'type' => 'int',
'input' => 'select',
'label' => 'Accounttype',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 1,
'source' => 'profile/entity_accounttype',
));
$setup->addAttribute('customer', 'tva', array(
'type' => 'int',
'input' => 'select',
'label' => 'Tva',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 2,
'source' => 'profile/entity_tva',
));
$setup->addAttribute('customer', 'companycountry', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Companycountry',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 4,
'source' => 'profile/entity_companycountry',
));
$setup->addAttribute('customer', 'companycomment', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Companycomment',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 3,
'source' => 'profile/entity_companycomment',
));
if (version_compare(Mage::getVersion(), '1.6.0', '<='))
{
$customer = Mage::getModel('customer/customer');
$attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
$setup->addAttributeToSet('customer', $attrSetId, 'General', 'accounttype','tva','companycountry','companycomment');
}
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
Mage::getSingleton('eav/config')
->getAttribute('customer', 'accounttype', 'tva','companycountry','companycomment' )
->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
->save();
}
$tablequote = $this->getTable('sales/quote');
$installer->run("
ALTER TABLE $tablequote ADD `customer_accounttype` INT NOT NULL,
ADD `customer_tva` INT NOT NULL,
ADD `customer_companycountry` varchar(100) NOT NULL,
ADD `customer_companycomment` varchar(1000) NOT NULL
");
$installer->endSetup();
I made 4 source model for each field. only one field us made & also data is not saving in database. Please help me where I am wrong.