I want to create a new tab name as "Preference" in customer dashboard and also admin side customer edit page. I successfully created new tab both side(means Admin and frontend).

Can any one suggest me how to create a two new field and display field in "preference tab" for both side and how i can add, edit field value.

1 Answer 1


Lifted from:

This is the code for a basic int attribute with text renderer:

$installer = $this;

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$entityTypeId     = $setup->getEntityTypeId('customer');
$attributeSetId   = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

$setup->addAttribute('customer', 'your_attribute_code_here', array(
    'input'         => 'text',
    'type'          => 'int',
    'label'         => 'Some textual description',
    'visible'       => 1,
    'required'      => 0,
    'user_defined' => 1,

 '999'  //sort_order

$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your_attribute_code_here');
$oAttribute->setData('used_in_forms', array('adminhtml_customer'));


The unusual step for adding attributes is the setData('used_in_forms') this seems to be unique to customer attributes. Without it, the field won't get rendered, certainly not in the adminhtml anyway. You can see the valid options for this array in the customer_form_attribute database table.

In terms of using a select with predefined options, this is what you need:

$iAttributeId = $installer->getAttributeId($entityTypeId, 'your_attribute_code_here');
$aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
$aOption = array();
$aOption['attribute_id'] = $iAttributeId;

    $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];

And here is a walk-through on using a custom source for your drop-down

Hope this helps,


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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