I have created a custom attribute "test_emails" by as following Store-->Store Attributes-->Add new Attribute, I put attribute code "test_emails" , that appeared in table "eav_attribute" and the field values in "customer_address_entity_text" as shown in Pic, Where 668 is attribute id form table "eav_attribute" for "test_emails", how can I get these values enter image description here

  • need get in customer address model?
    – Abdul
    Nov 24 '15 at 12:13
  • Can you see the attribute in admin ? Looks like you have used some extension to create customer attribute.
    – Prateek
    Nov 24 '15 at 12:22
  • @Abdul"need get in customer address model? " what do you meant?, I am new to magento, can you guide me? Nov 24 '15 at 12:26
  • @Prateek yes I can see them in Customer-->Manage Customer-->Customer Information-->Address Nov 24 '15 at 12:29
  • Currently I have two address for Single customer, due to this you can see two rows In pic entity_id (3663,2557) are address id's for that user Nov 24 '15 at 12:33

Add bellow code in php file(abc.php) on magento root folder and run in browser and see admin side Customer-->Manage Customer-->Customer Information-->Address,


class ABDUL
    public function index()    
        $installer = new Mage_Eav_Model_Entity_Setup('core_setup');

        $entityTypeId     = $installer->getEntityTypeId('customer_address');
        $attributeSetId   = $installer->getDefaultAttributeSetId($entityTypeId);
        $attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

        $installer->addAttribute('customer_address', 'company_name', array(
            'input'         => 'text',
            'type'          => 'varchar',
            'label'         => 'Company Name',
            'visible'       => 1,
            'required'      => 0,
            'user_defined' => 1,

         '22'  //sort_order

        $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'company_name');
        $oAttribute->setData('used_in_forms', array('adminhtml_customer_address','customer_address_edit','customer_register_address'));

        echo "Customer address attribute has been created successfully";


$obj = new ABDUL();
  • What does this code do, Nov 24 '15 at 13:24
  • I need to read the value, not to crate the new attribute Nov 24 '15 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.