Friday, March 23, 2012

Magento Add New field in Customer Admin

Adding an Attribute in Product quite simple we can add through admin but adding a field(attribute) in customer cannot be achieved through admin so here is the simple solution for adding the attribute in Category through Database.Open the phpmyadmin.Here we need to work on three tables.



First query for the eav_attribute table
Insert into eav_attribute
`attribute_id` = '',
`entity_type_id` = 1,
`attribute_code` = 'new_attribute_code',
`attribute_model` = NULL,
`backend_model` = '',
`backend_type` = 'text',
`backend_table` = '',
`frontend_model` = '',
`frontend_input` = 'text',
`frontend_label` = 'New Attribute Name',
`frontend_class` = NULL,
`source_model` = '',
`is_required` = 0,
`is_user_defined` = 0,
`default_value` = '',
`is_unique` = 0,
`note` = ''

After insert this query it will generate attribute id that attribute id we will be using for our next query
for Us it had generated 963 so we are using that in our query

We need to run the Query in the following table "customer_form_attribute" as my attribute id = 963

Second Query for customer_form_attribute
INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('adminhtml_customer', '963');
INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('customer_account_create', '963');
INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('customer_account_edit', '963');
INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('adminhtml_customer_address', '963');

and thus clear the cache manually and from admin your new feild be added in the admin for customer 

2 comments:

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...