I want to add new field Title. This field is a Dropdown and I give value like this.
$attributes = array(
'jobtitle' => array(
'label' => 'Title',
'backend_type' => 'varchar',
'frontend_input' => 'select',
'is_user_defined' => 1,
'is_system' => 0,
'is_visible' => 1,
'sort_order' => 140,
'is_required' => 1,
'multiline_count' => 0,
'option' => array (
'value' => array(
'Mr' => array('Mr'),
'Mrs' => array('Mrs'),
'Ms' => array('Ms'),
'Miss' => array('Miss'),
'Dr' => array('Dr'),
)
),
'validate_rules' => array(
'max_text_length' => 255,
'min_text_length' => 1
),
),
);
foreach ($attributes as $attributeCode => $data) {
$attribute = $eavConfig->getAttribute('customer_address', $attributeCode);
$attribute->setWebsite($store->getWebsite());
$attribute->addData($data);
$usedInForms = array(
'adminhtml_customer_address',
'customer_address_edit',
'customer_register_address'
);
$attribute->setData('used_in_forms', $usedInForms);
$attribute->save();
}
There is a options is my dropdown value. when I see in the admin side, field is added and the dropdown is displayed but this value is not set. I am getting the blank Dropdown. Please help.
Best Answer
If you are trying to add title in-front of customer name, it's an in-built feature in Magento. Go to
System > Configuration
. And under Customers tab selectcustomer configurations
. See the image below.