Try the Demo

Magento Forum

   
Page 1 of 3
Remove customer phone # as required field during checkout
 
mittymoo
Jr. Member
 
Total Posts:  8
Joined:  2007-10-15
 

Is there any way to change it so phone # is not a required field?

Thanks,

JJ

 
Magento Community Magento Community
Magento Community
Magento Community
 
comdc
Jr. Member
 
Total Posts:  11
Joined:  2008-09-19
 

I’m also interested in this topic; i’ve searched through the Checkout code but nothing found..

Greetings
comdc

 
Magento Community Magento Community
Magento Community
Magento Community
 
hazardpro
Member
 
Avatar
Total Posts:  53
Joined:  2008-10-09
 

BUMP

Me too....

Anyone?

 Signature 

I found cheap, fast Magento web hosting at Pixel Internet who are based in the UK.

 
Magento Community Magento Community
Magento Community
Magento Community
 
got-bonsai
Sr. Member
 
Avatar
Total Posts:  136
Joined:  2008-10-25
Wales, UK
 

To do this comment out this section (as shown)

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

at line 321-323 of app/code/core/mage/customer/model/address/abstract.php
duplicate the file and folder structure in your app/local folders to preserve changes.

Then you need to remove the visual settings..
Edit app/design/frontend/"My Theme"/"My Theme"/template/checkout/onepage/billing.phtml

<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>

find these lines and remove <span class="required">*</span> from the telephone section and the required-entry input-text from the class selector as shown above.

You should also make the same changes in app/design/frontend/"My Theme"/"My Theme"/template/customer/address/edit.phtml so that it also works when a registered customer edits their address.
Good luck
Tom.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hazardpro
Member
 
Avatar
Total Posts:  53
Joined:  2008-10-09
 

Awesome thanks Tom I’ll give that a go.

 Signature 

I found cheap, fast Magento web hosting at Pixel Internet who are based in the UK.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SteveDowns
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2009-01-03
 

This Required Telephone matter has been reported as Bug Issue #6428. cool smile

 Signature 

EnviroPicnic

 
Magento Community Magento Community
Magento Community
Magento Community
 
hazardpro
Member
 
Avatar
Total Posts:  53
Joined:  2008-10-09
 

Worked a treat.

PLEASE NOTE

You will also need to make the change to your shipping.phtml page

Edit app/design/frontend/"My Theme"/"My Theme"/template/checkout/onepage/shipping.phtml

 Signature 

I found cheap, fast Magento web hosting at Pixel Internet who are based in the UK.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sailor2040
Jr. Member
 
Total Posts:  12
Joined:  2008-11-02
Bavaria, Germany
 

thanks for the hint.
I did the changes above, but now when I click to send the form, the phone number field is marked as required again.
Did I forgot something to modify (abstract.php, billing.phtml, edit.phtml)?

 Signature 

Magento Ver. 1.2.1

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jeremy Breece
Jr. Member
 
Total Posts:  2
Joined:  2008-07-16
Nashville, TN
 

Is there still no way to make telephone optional using the admin, instead of editing the files?  Perhaps in a newer version of magento? I’m still using version 1.1.6.

 
Magento Community Magento Community
Magento Community
Magento Community
 
vianetz
Guru
 
Avatar
Total Posts:  537
Joined:  2008-04-13
Munich, Germany
 

No, no way.

 Signature 

vianetz.com - Magento Development
Customizable layouts for invoices? Check out Advanced Invoice Layout For Magento.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kara Heinrichs
Guru
 
Avatar
Total Posts:  482
Joined:  2008-01-17
aa, mi, us
 

Right, no admin option to do that yet.

But you can avoid editing the core files and just edit the phtml theme files.  In billing.phtml (above) for example, from the telephone <input...> tag, just remove the “required-entry” class (change class="required-entry input-text” to class="input-text").  Voila!  Not required.

 Signature 

Founder and Principal at Brillig House, specializing in Magento consulting, training and theme design.

Check out mage-page.net for links to Magento blogs and current articles from around the web.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tomakun
Sr. Member
 
Total Posts:  77
Joined:  2008-10-21
 
kara - 26 March 2009 12:26 PM

Right, no admin option to do that yet.

But you can avoid editing the core files and just edit the phtml theme files.  In billing.phtml (above) for example, from the telephone <input...> tag, just remove the “required-entry” class (change class="required-entry input-text” to class="input-text").  Voila!  Not required.

This will absolutely not work.

gotbonsai has given the right way to do it for now (look a few entries up), stick with this solution.

 
Magento Community Magento Community
Magento Community
Magento Community
 
shaunlonghurst
Member
 
Total Posts:  68
Joined:  2009-04-22
UK
 
got-bonsai - 22 November 2008 02:40 PM

To do this comment out this section (as shown)

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

at line 321-323 of app/code/core/mage/customer/model/address/abstract.php
duplicate the file and folder structure in your app/local folders to preserve changes.

Then you need to remove the visual settings..
Edit app/design/frontend/"My Theme"/"My Theme"/template/checkout/onepage/billing.phtml

<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>

find these lines and remove <span class="required">*</span> from the telephone section and the required-entry input-text from the class selector as shown above.

You should also make the same changes in app/design/frontend/"My Theme"/"My Theme"/template/customer/address/edit.phtml so that it also works when a registered customer edits their address.
Good luck
Tom.

I have followed the above and cannot get it to work. I can get it to work if i amend the core code though, which i don’t want to do. Here is what i have done. I have a module called MyModule and have created

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

in here i have

<?php
class MyModule_Customer_Model_Address_Abstract extends Mage_Customer_Model_Address_Abstract
{
     
/**
     * Validate address attribute values
     *
     * @return bool
     */
    
public function validate()
    
{
        $errors 
= array();
        
$helper Mage::helper('customer');
        
$this->implodeStreetAddress();
        if (!
Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter first name.');
        
}

        
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter last name.');
        
}

        
if (!Zend_Validate::is($this->getStreet(1), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter street.');
        
}

        
if (!Zend_Validate::is($this->getCity(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter city.');
        
}

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

        
if (!Zend_Validate::is($this->getPostcode(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter zip/postal code.');
        
}

        
if (!Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter country.');
        
}

        
if ($this->getCountryModel()->getRegionCollection()->getSize()
               && !
Zend_Validate::is($this->getRegionId(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter state/province.');
        
}

        
if (empty($errors)) {
            
return true;
        
}
        
return $errors;
    
}

}
?>

I have added a setting to the /app/etc/modules/MyModule_All.xml

<MyModule_Customer>
        <
active>true</active>
        <
codePool>local</codePool>
 </
MyModule_Customer>

and have added all the other changes. But when i click save i still get an alert box asking me to enter a telephone number. So because it is working when i comment it out in the core code and not in my overriding i guess it is an issue with my overridding?

Any help greatly appreciated

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tomakun
Sr. Member
 
Total Posts:  77
Joined:  2008-10-21
 

I would like to bring attention to this thread again, as the method described above that consist in commenting some lines on Abstract.php doesn’t work anymore (version 1.3.2.3)

Now this is really annoying. Anyone got this working on the latest version ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
AITOC
Guru
 
Avatar
Total Posts:  603
Joined:  2009-02-19
US
 
Tomakun - 20 August 2009 12:48 AM

I would like to bring attention to this thread again, as the method described above that consist in commenting some lines on Abstract.php doesn’t work anymore (version 1.3.2.3)

Now this is really annoying. Anyone got this working on the latest version ?

Hello,

You can do this and not only with the help of our Configurable Checkout module. Please feel free to read more about it here:
http://www.magentocommerce.com/extension/1565

Have a nice day.

 Signature 

AITOC Mods for Magento
Join AITOC on Facebook for exclusive deals

 
Magento Community Magento Community
Magento Community
Magento Community
 
got-bonsai
Sr. Member
 
Avatar
Total Posts:  136
Joined:  2008-10-25
Wales, UK
 

We’re using 1.3.2.3 and its still working with the edit to abstract.php described above at post #3 (except now at lines 346-348). We’ve updated several time since then. It still works.
The core file is unedited, the edited file is in the code/local directory structure.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 3