Follow by Email

Friday, April 10, 2015

How to create new attributes for customer

Hello Friend,
I have found some small and Quick solution for creating attribute for customer.
Login your Admin and follow the stapes.
Catalog -> Attribute -> Manage Attributes
Now create an attribute. It might be text box or drop down
Now open your phpmyadmin & find out eav_attribute table Now find out your attribute with your attribute_code and change entity_type_id with 1. Because 1 stand for customer attribute.
Now from any controller just run the following code


$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your attribute code');
$oAttribute->setData('used_in_forms', array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'));
$oAttribute->save();

No comments:

Post a Comment