0

When I fill out the form and send to customer base, magento returns the message Telephone is a required field

I've tried removing the validation of the phone field in HTML, JS and Databases, yet still blocking me the customer base.

It sends the value of the completed field, but still returns a message that is a required field

enter image description here enter image description here

4
  • Does this error persists when you fill out all the fields in your form including telephone?
    – Prateek
    Commented Aug 5, 2015 at 17:47
  • Yes this error persists :/ Commented Aug 5, 2015 at 18:47
  • I thought your "celular" field was conflicting with default Telephone field, but seems not if whole completed form is throwing error too. Is there any chance you are using any extension or custom override for customer data or onepage checkout?
    – Prateek
    Commented Aug 5, 2015 at 18:55
  • It can be a aternativa but managed to solve by changing the database , the question was that the websites that suggest a solution point to a Telephone attribute, but the table has two eav_attribute Telephone records before was just changing the record with id = 34 changing is_required the value to 0 , bad when selected all records on this table I noticed another Telephone with is_required = 1 , when changed this allowed me to checkout . Commented Aug 5, 2015 at 19:53

2 Answers 2

0

To remove validation for telephone number. You need to do three things.

Step 1:

remove client side validation for telephone input field.(remove validation class) In following files

checkout/onepage/shipping.phtml
checkout/onepage/billing.phtml      persistent/checkout/onepage/billing.phtml

Step 2: Need to remove validation from code side. app/code/core/Mage/Customer/Model/Address/Abstract.php

Copy this file to local

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

Then find a line

if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {

    $this->addError(Mage::helper('customer')->__('Please enter the telephone number.'));

}

Comment the above lines to remove the validation from code side

Step 3: Need to remove validation value from DB. For that follow @saravanvelu answer.

Refer this

1

I think it may be due to that the telephone is the required field in eav_attribute table.

Try this,

To change the required field value ,

//31 is telephone's attribute id in eav_attribute table
//2 is entity_type_id for customer/address in eav_entity_type table

UPDATE `eav_attribute` SET `is_required`= 0 WHERE `attribute_id` = 31 and `entity_type_id` = 2

To remove validation rules for telephone field,

 UPDATE `customer_eav_attribute` SET `validate_rules`= null WHERE `attribute_id` = 31
1
  • He keeps returning the error message , the form sends the field value but does not accept! Commented Aug 5, 2015 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.