Tagged: magento Toggle Comment Threads | Keyboard Shortcuts

  • Reinoud 21:14 on 1 March 2011 Permalink | Reply
    Tags: magento   

    Magento: Removing mandatory validation of telephone field 

    Searching the web for ways to remove the mandatory validation of the telephone field in Magento I found quite a lot results non of which actually worked with Magento ver. or up. The biggest problem seems to be to completely remove the validation and mandatory state of the telephone field throughout the whole Magento store. Some solutions fixed it in the checkout, some fixed the client side validation but not a single solution fixed it all.

    The final solution contains three steps which are:

    1. Remove client-side (javascript) validation

    If they not already exist within your theme copy the following files from the base/default theme to your theme:

    • template/customer/address/edit.phtml
    • template/checkout/onepage/shipping.phtml
    • template/checkout/onepage/billing.phtml

    In each of these files, look for the <input> that defines the telephone field and remove the required class from the label, remove the required-attribute class from the input and make sure to remove the *.

    2. Redefine the Mage_Customer_Model_Address_Abstract class

    Copy the file app/code/core/Mage/Customer/Model/Address/Abstract.php to app/code/local/Mage/Customer/Model/Address/Abstract.php . This ensures that upgrades will not break your modifications. Now open the file and look for the part where it validates the telephone field, it should look something like this:

    if (!Zend_Validate::is($this-&gt;getTelephone(), 'NotEmpty')) {
    $errors[] = $helper-&gt;__('Please enter the telephone number.');

    You can either completely remove this part or comment it out by placing it between /* and */ .

    3. Change the Customer EAV in the database

    Except for the validation we just removed in the abstract class Magento keeps a validation definition in it’s EAV tables. In the table customer_eav_attribute look for the row with id attribute_id 30 and clear the contents of the column validation_rules. Next in the table eav_attribute loo for the row with attribute_id 30 and make sure that the value of the column is_required is 0.

    Completing the above steps will effectively clear the validation and the mandatory state of the Telephone field.

    • Nikolas 16:41 on 4 mei 2011 Permalink | Reply

      Thanks for this, I had been looking for a way to remove the requirement from the admin for a along time now after having managed to get the frontend working without phone one my own.
      It seem that the db change for “customer_eav_attribute” is not required anymore (magento v1.4.1.1), matter of fact, that table doesn’t have a “validation_rules” column. Also in the “eav_attribute” table, the telephone entry was row 29 for me, but I guess one can simply search for phone to find it.. 😉

    • Matthias Balke 21:34 on 22 mei 2011 Permalink | Reply

      Thanks for this tutorial!
      I have only one problem: there is no attribute_id 30 in my customer_eav_attribute table. How can I identify the correct row?


      • Nick 01:48 on 27 mei 2011 Permalink | Reply

        I am using and found the table eav_attribute had it as attribute code 17. There was a required field that I changed from a 1 to a 0 and checkout worked great!

      • Magento Notes 10:31 on 25 augustus 2011 Permalink | Reply

        You can see app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade- or other mysql.php file
        find ‘sort_order’, and
        In datebase table ‘customer_eav_attribute’ , you can search ‘attribute_id’ by ‘sort_order’

    • Chris S. 07:03 on 12 september 2011 Permalink | Reply

      I have performed all these steps and I am still getting a pop-up that states “Please enter the telephone number.” Can someone please help me with this. I am running Magento 1.4.

    • john 10:27 on 7 mei 2012 Permalink | Reply

      Attempting this in Magento is a straight *fail* I’ve been pestering every possible sollution i’ve found online and none seem to remove the input boxes and validation.

      Anybody with a good sollution for the new magento?

    • Erma 17:24 on 2 augustus 2012 Permalink | Reply

      I tried it on 1.5.0 and ist not working.
      Thanks for help

    • Robby 18:19 on 2 oktober 2012 Permalink | Reply


      change in file /app/code/core/Mage/XmlConnect/Block/Customer/Address/Form.php

      $contactInfoFieldset->addField(‘telephone’, ‘text’, array(
      ‘label’ => $this->__(‘Telephone’),
      ‘required’ => ‘true’,
      ‘value’ => isset($telephone) ? $telephone : ”


      $contactInfoFieldset->addField(‘telephone’, ‘text’, array(
      ‘label’ => $this->__(‘Telephone’),
      ‘value’ => isset($telephone) ? $telephone : ”

      this work for me after i doing step 1 & 2 of this tutorial. Magento 1.7.

    • Thomas 09:14 on 25 januari 2013 Permalink | Reply

      Hi, i’ve done all the described steps (Magento 1,7) and as some of you i still get the popup ‘Please enter the telephone number’. The same with the region, which isn’t necessary in germany. Any ideas or solutions to that?

    • Thomas 09:06 on 29 januari 2013 Permalink | Reply

      Addition to my comment from a few days before: on the system I made the above described changes I had the compilation acvtivetd. After changing the file template/persitent/checkout/onepage/billing.phtml and recompiling Magento (System > Tools) everything works fine.

    • Hugo 14:36 on 26 april 2013 Permalink | Reply

      In the latest version of magento you have to edit the files in the persistant folder to edit the register fields in the onepage checkout etc.:

    • Mike 13:59 on 10 juni 2013 Permalink | Reply

      This can be done easily by editing:

      Just replace the phone input field with:

      A hidden field will be posted so you don’t have to remove things in code like validation.

    • Bicky 13:59 on 23 december 2014 Permalink | Reply

      HI all,
      I just followed the instructions but it didnt worked out for me. Lastly i had change the 2nd step of this article in app/code/core/Mage/Customer/Model/Address/Abstract.php itself.

      Thank you

    • omkar 13:13 on 29 december 2014 Permalink | Reply


    • daniel 18:27 on 30 december 2014 Permalink | Reply

      Hello, i want to remove all mandatory fields excepts the customer name ONLY IN ADMIN. Is this possible?

    • Prasad 08:59 on 5 juni 2015 Permalink | Reply


    • kamal 07:07 on 2 september 2015 Permalink | Reply


      do not change in Database file………
      you change in Text.php file..

      change this:

      if ($attribute->getIsRequired() && strlen($value) == 0) {
      $errors[] = Mage::helper(‘eav’)->__(‘”%s” is a required value.’, $label);

      with :

      if ($attribute->getIsRequired() && strlen($value) == 0)
      if($label != ‘Telephone’)
      $errors[] = Mage::helper(‘eav’)->__(‘”%s” is a required value.’, $label);

    • kamal 07:08 on 2 september 2015 Permalink | Reply


      do not change in Database file………
      you change in Text.php file..

      change this:

      if ($attribute->getIsRequired() && strlen($value) == 0) {
      $errors[] = Mage::helper(‘eav’)->__(‘”%s” is a required value.’, $label);

      with :

      if ($attribute->getIsRequired() && strlen($value) == 0)
      if($label != ‘Telephone’)
      $errors[] = Mage::helper(‘eav’)->__(‘”%s” is a required value.’, $label);

      Email : kamalj27@gmail.com, Kamal Jain

    • Ramya Aravind 07:26 on 23 augustus 2017 Permalink | Reply

      Thank You Robby and Kamal ..:)

  • Reinoud 23:15 on 25 January 2011 Permalink | Reply
    Tags: downloader, magento, pear, upgrade   

    Problems with Magento’s PEAR 

    Trying to install some extensions today on a Magento installation I experienced the following error using Magento Connect:

    pear/Console_Getopt requires PEAR Installer (version >= 1.9.1), installed version is 1.7.1

    If you experience errors similar errors while using Magento Connect or Magento’s ./pear script try upgrading your PEAR installation using PEAR. Login in via SSH to the server running your Magento installation. Change your working-directory  to the root of the Magento installation and run the following two commands:

    ./pear channel-update pear.php.net
    ./pear upgrade --force PEAR

    Doing that should upgrade your PEAR installation to the latest version. After that you should be able to install extensions using Magento connect as always.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc

Close your account?

Your account will be closed and all data will be permanently deleted and cannot be recovered. Are you sure?

Are you sure?

By disagreeing you will no longer have access to our site and will be logged out.