Magento Wizard
Latest Stories: 

Write articles for us and make money!  Make Money

Remove Validation from Phone Number Field on Magento Checkout

 Add to Favourites   Email This Post Email This Post
 Very handy...  This Blog WASN\'TThis Blog WAS
Loading ...

If you’re looking to remove the validation of telephone number (or the whole field completely) from the Magento checkout process, look no further.  I’ve read that quite a few people have had some difficultly in removing this field - not only because sometimes it is difficult to find the correct template, but moreso because Magento tries to validate this field when the Continue button is pressed on the checkout - so even if you manually remove the field, you cannot progress onto the next stage of the checkout!

Until now. 

Simply navigate to the file app/code/core/mage/customer/model/address/abstract.php and find the phrase “getTelephone” and you should comment out the code around this area, like so:

1
2
3
/*if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
            $errors[] = $helper->__('Please enter telephone.');
        }*/

Similarly, to remove the actual field itself, go to app/design/frontend/default/default/template/checkout/onepage/billing.phtml and app/design/frontend/default/default/template/customer/address/edit.phtml and remove the…

1
<span class="required">*</span>

…or just delete the whole field! If you are doing the former, it’ll look something like this:

1
2
3
4
5
6
7
8
9
10
<li><div class="input-box">
                <label for="billing:postcode"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
                <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" /></div>
                <div class="input-box">
                    <label for="billing:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
                    <?php echo $this->getCountryHtmlSelect('billing') ?></div></li>
            <li><div class="input-box">
                <label for="billing:telephone"><?php echo $this->__('Telephone') ?> </label><br/>
                <input type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" /></div>
                </li>

Good luck!

Digg   del.icio.us   Facebook   Google   LinkedIn   Live   Reddit   StumbleUpon   Technorati   TwitThis  

about the author

    This article was written by Sam Davis on November 28, 2008.
    Computing over a glass of Grenache Shiraz... again!
    Sam encourages you to make money by writing articles for us! Learn More

related articles

 Change Credit/Debit Card name in Magento
 Magento Single Page Checkout - Video Guide
 Show Product Description on Magento Shopping Cart page
 Insecure or non-secure pages on the Magento Checkout
 Make "Ship to this address" default in Magento Checkout

comments

Leave a Reply





Make “Ship to This Address” Default in Magento Checkout
    Magento Hosting
    Magento Themes
    Just wanted to say that Inline translating is the best thing ever. I love magento....
  • Sponsored Ads

  • The New Blasted Thing

    Blasted Thing has recently undergone an essential re-design, as we prepare to welcome a host of new features in to our web-site.

    We will continue to be gathering useful articles, tutorials and advice regarding Magento - and we'll be focusing on a number of hosting and theme companies which we have independently verified.

  • Translate this page

    Translate