Tagged:magento Wissel reactie discussies | Sneltoetsen

  • Reinoud 21:14 op 1 March 2011 Permalink | Beantwoorden
    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 op 4 mei 2011 Permalink | Beantwoorden

      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 op 22 mei 2011 Permalink | Beantwoorden

      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 op 27 mei 2011 Permalink | Beantwoorden

        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 op 25 augustus 2011 Permalink | Beantwoorden

        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 op 12 september 2011 Permalink | Beantwoorden

      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 op 7 mei 2012 Permalink | Beantwoorden

      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 op 2 augustus 2012 Permalink | Beantwoorden

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

    • Robby 18:19 op 2 oktober 2012 Permalink | Beantwoorden


      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 op 25 januari 2013 Permalink | Beantwoorden

      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 op 29 januari 2013 Permalink | Beantwoorden

      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 op 26 april 2013 Permalink | Beantwoorden

      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 op 10 juni 2013 Permalink | Beantwoorden

      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.

  • Reinoud 23:15 op 25 January 2011 Permalink | Beantwoorden
    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.

Maak een nieuw bericht
volgende post/volgende reactie
vorige post / vorige opmerking
toon / verberg reacties
ga naar boven
ga naar log-in
hulp weergeven/verbergen
shift + esc