I have created a custom attribute in Customer Address (govt_id
) and it is showing on Adminhtml UI, but when I retrieve the customer address attributes it's not getting it.
my setup code:
<?php
$this->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer_address', 'govt_id', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'GOVT ID',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'default' => '0',
'visible_on_front' => 0,
));
Mage::getSingleton('eav/config')
->getAttribute('customer_address', 'govt_id')
->setData('used_in_forms', array('customer_register_address','customer_address_edit','adminhtml_customer_address'))->save();
$this->endSetup();
And i'm getting attributes by using below code
$magentoAttributes = Mage::getModel('customer/address')->getAttributes();
foreach(array_keys($magentoAttributes) as $att)
{
$name = $att;
$this->magentoOptions[$att] = $name;
}
Mage::log( $this->magentoOptions);
Result:
2015-09-14T06:35:15+00:00 DEBUG (7): Array
(
[entity_id] => entity_id
[entity_type_id] => entity_type_id
[increment_id] => increment_id
[parent_id] => parent_id
[attribute_set_id] => attribute_set_id
[created_at] => created_at
[updated_at] => updated_at
[prefix] => prefix
[firstname] => firstname
[middlename] => middlename
[lastname] => lastname
[suffix] => suffix
[company] => company
[street] => street
[city] => city
[country_id] => country_id
[region] => region
[region_id] => region_id
[postcode] => postcode
[telephone] => telephone
[fax] => fax
[vat_is_valid] => vat_is_valid
[vat_request_id] => vat_request_id
[vat_request_date] => vat_request_date
[vat_request_success] => vat_request_success
[vat_id] => vat_id
)
Here the govt_id
attribute is missing.
I have cleared cache also, but still it's not getting Why?
Did I do anything wrong or is something missing?