0

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

1
  • Check any files rewrite the customer.php Commented Sep 8, 2015 at 14:30

2 Answers 2

1

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)

1
  • It's best practice to learn how to write the Magento SQL script for this, but if you know the ID alan-ch is likely spot on with the tables. Commented Feb 27, 2016 at 23:43
0

I have used 1.9.2.4 and followed the below steps and it worked fine.

  1. Remove the classes for JS validation from your templates. customer/widget/name.phtml Remove class="required" from the label relating to the ‘lastname’ field Remove

    <?php echo $this->helper('customer/address')->getAttributeValidationClass('lastname') ?> from the input relating to ‘lastname’ 
  2. Copy your core files from:

    • /app/code/core/Mage/customer/Model/Address/Abstract.php
    • /app/code/core/Mage/customer/Model/Customer.php

    into:

    • /app/code/local/Mage/customer/Model/Address/Abstract.php
    • /app/code/local/Mage/customer/Model/Customer.php

    And comment out everything related to Zend validation of 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.'); } */ 
  3. Update the config.xml file for customer /app/code/core/Mage/customer/etc/config.xml

    <lastname> <billing>1</billing> <shipping>1</shipping> <required>0</required> <mapped>1</mapped> </lastname> 
  4. Update the eav_attribute database table to remove the required flag

    UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname' 
  5. Update the validation rules in the customer_eav_attribute table

    UPDATE customer_eav_attribute SET validate_rules = 'a:1:{s:15:"max_text_length";i:255;}' WHERE customer_eav_attribute.attribute_id = 7; UPDATE customer_eav_attribute SET validate_rules = 'a:1:{s:15:"max_text_length";i:255;}' WHERE customer_eav_attribute.attribute_id = 22; 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.