Magento – Remove last name in billing address

addressattributeseavmagento-1.9

I am using Magento1.9 I followed below mention step after that i got error message

UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname'

/app/code/local/Mage/customer/Model/Address/Abstract.php:

 /* if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
         $this->addError(Mage::helper('customer')->__('Please enter the last name.'));
     }
*/

/app/code/local/Mage/customer/Model/Customer.php

/*        if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) {
        $errors[] = Mage::helper('customer')->__('The last name cannot be empty.');
    }
*/

/app/code/local/Mage/customer/etc/config.xml

<lastname>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    **<required>0</required>** // change from 1 to 0
                    <mapped>1</mapped>
     </lastname>

enter image description here

Best Answer

I'm sure you have this figured out by now but it might help someone else.

I am using Magento CE 1.9.2. In addition to what you have already done, try this:

  1. Comment/delete required class in app/design/frontend/PACKAGE/THEME/template/persistent/checkout/onepage/billing.phtml. You might also have to do the shipping.phtml as well depending on your needs.

  2. Change the validation rules in customer_eav_attribute table for the attribute id you are changing (get it from the eav_attribute table)

Related Topic