Remove Telephone Field from Opencart Required Registration

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

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

personal technology columnist, author and founder of wRock.org, a widely read tech and how-to blog since 2009. Wants to explore and share interesting Tips, Tutorials and More. Also WordPress Theme Designer @ here. Contact: Contact

8 thoughts on “Remove Telephone Field from Opencart Required Registration

  1. HI , i am trying to move telephone field from personal section to shipping and billing address section. i want this to be done as i am using social login and not able to get customer number. I am using oc 2.0.3.1 with journal theme. please help.

Leave a Reply

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