in

Remove Telephone Field from Opencart Required Registration

Opencart is best open source software for small and medium eCommerce business websites but there is some limit comes and it does not provide full control over design for example if you are selling digital downloadable good and does no require shipping address and telephone number then how you can remove. Today we provide solution to remove telephone field from OpenCart checkout and register page. Just follow steps and also must take backup first before we proceed

We need edit on server directory so access it via FTP or web browser:

  1. Edit the first template file to remove the actual field from the html:

    catalog/view/theme/YOURTHEME/template/account/register.tpl

  2. Find and Remove the form field and surrounding table code. You should be able to follow the pattern of the file based on the tabbing.

    <tr><td><span class=”required”>*</span> <?php echo $entry_telephone; ?></td><td><input type=”text” name=”telephone” value=”<?php echo $telephone; ?>” /><?php if ($error_telephone) { ?><span class=”error”><?php echo $error_telephone; ?></span><?php } ?></td></tr>

  3. Now you need to EDIT the controller file to remove the error checking:

    catalog/controller/account/register.php

  4. FIND and REMOVE the validation code. All validation is done in the “validate” function towards the bottom. Find and remove the following:

    if ((utf8_strlen($this->request->post[‘telephone’]) < 3) || (utf8_strlen($this->request->post[‘telephone’]) > 32)) {$this->error[‘telephone’] = $this->language->get(‘error_telephone’);}

    That completes the necessary changes for the account/register step.

  5. Edit checkout/register template file:

    catalog/view/theme/YOURTHEME/template/checkout/register.tpl

  6. Find and Remove the actual form field so no options display there:

    <span class=”required”>*</span> <?php echo $entry_telephone; ?><br /><input type=”text” name=”telephone” value=”” class=”large-field” /><br /><br />

  7. Edit the associated controller

    catalog/controller/checkout/register.php

  8. Find and Remove the validation check:

    if ((utf8_strlen($this->request->post[‘telephone’]) < 3) || (utf8_strlen($this->request->post[‘telephone’]) > 32)) {$json[‘error’][‘telephone’] = $this->language->get(‘error_telephone’);}

    That completes the necessary changes for the checkout/register step.

  9. To prevent warnings massage and popup open catalog/model/account/customer.php here search and remove below line

    telephone = ‘” . $this->db->escape($data[‘telephone’]) . “‘,

  10. EDIT the checkout/guest template file:

    catalog/view/theme/YOURTHEME/template/checkout/guest.tpl

  11. FIND and REMOVE the actual form field:

    <span class=”required”>*</span> <?php echo $entry_telephone; ?><br /><input type=”text” name=”telephone” value=”<?php echo $telephone; ?>” class=”large-field” /><br /><br />

 

 

telephone-field
Result on Checkout Page

8 Comments

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

tata docomo logo

Tata Docomo Free 3G Internet Data Offer for Mobiles Promo

Setup eSell WooCommerce Premium Theme – Guide