How to make phone field optional

If you need to make the telephone need optional you have to perform two file edits as follows:

  1. first open up app/design/frontend/base/default/template/onestepcheckout/billing_fields.phtml and remove the required validation class from template by replacing the following:

<?php if(!$this->settings['exclude_telephone']):?>

<?php $billingFields['telephone'] = '
<div class="input-box input-telephone'.((in_array('telephone', $formErrors)) ? ' input-error' : '').'">
<label for="billing:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/>
<input type="text" name="billing[telephone]" value="'.$this->htmlEscape($this->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="billing:telephone" />
</div>';
?>

<?php endif; ?>

with

<?php if(!$this->settings['exclude_telephone']):?>

<?php $billingFields['telephone'] = '
<div class="input-box input-telephone'.((in_array('telephone', $formErrors)) ? ' input-error' : '').'">
<label for="billing:telephone">'.$this->__('Telephone').' </label><br/>
<input type="text" name="billing[telephone]" value="'.$this->htmlEscape($this->getTelephone()).'" title="'.$this->__('Telephone').'" class="input-text" id="billing:telephone" />
</div>';
?>

<?php endif; ?>

  1. open up app/code/local/Idev/OneStepCheckout/Helper/Checkout.php and replace the following:

if( $this->settings['exclude_telephone'] ) {

$data['telephone'] = '-';

}

with

if( $this->settings['exclude_telephone'] || empty($data['telephone'])) {

$data['telephone'] = '-';

}