Magento1 Customer Attribute – Make Last Name Optional

customercustomer-attributemagento-1

i want to make last name optional , can i do it via any setting in admin ?? or what will be best way to do it.. how can i do it via code , i tried setting customer attributes but no sucess

Best Answer

I think you have to do two things, first, update the attribute last name:

Implement your own setup, depending on Mage_Catalog_Model_Resource_Setup:

$this->updateAttribute('customer', 'last_name', 'is_required', 0);

"Beware of bugs in the above code, I only proved it correct, not tried it" - Donald Knuth

And second you need to change the registration template app/design/frontend/base/default/template/customer/widget/name.phtml, and remove the <em>*</em> for lastname. Magento will take care of the correct class for JS validation.

Related Topic