Page 1 of 1

Contact form telephone not required

Posted: Thu Dec 09, 2010 6:27 am
by murray
Hi,

This is one of those things which should be really easy if you knew exactly what you were doing, but I don't!

I want to make the telephone field on the contact form not required, how can I do this?

Thanks for any help.

Re: Contact form telephone not required

Posted: Thu Dec 09, 2010 9:44 am
by JAY6390
Do you mean so you don't have to enter one?

Re: Contact form telephone not required

Posted: Thu Dec 09, 2010 7:57 pm
by murray
No I want people to be able to add their phone number if they want to but not have it compulsory.

Thanks

Re: Contact form telephone not required

Posted: Fri Dec 10, 2010 5:07 pm
by murray
Sorry to bump this but can anybody help?

Thanks

Re: Contact form telephone not required

Posted: Sat Dec 11, 2010 8:02 am
by SteveSherry
Telephone number on the contact form?
My cart doesn't have one.

Re: Contact form telephone not required

Posted: Sat Dec 11, 2010 12:46 pm
by rezter
Do you mean when a customer registers an account, you don't want it to be required that they need to give you a telephone number?

If so:

In:

Code: Select all

catalog/view/theme/YOURTHEME/template/account/create.tpl
Find:

Code: Select all

          <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>
Replace with:

Code: Select all

          <tr>
            <td><?php echo $entry_telephone; ?></td>
            <td><input type="text" name="telephone" value="<?php echo $telephone; ?>" /></td>
          </tr>
Then...
In:

Code: Select all

catalog/controller/account/create.php
Find:

Code: Select all

        if (isset($this->error['telephone'])) {
            $this->data['error_telephone'] = $this->error['telephone'];
        } else {
            $this->data['error_telephone'] = '';
        } 
and DELETE it.

Then....
Find:

Code: Select all

        if ((strlen(utf8_decode($this->request->post['telephone'])) < 3) || (strlen(utf8_decode($this->request->post['telephone'])) > 32)) {
              $this->error['telephone'] = $this->language->get('error_telephone');
        } 
and DELETE it.

That should do it.

Re: Contact form telephone not required

Posted: Sat Mar 12, 2011 5:43 pm
by Stije
jeuj thanks rezter :) ....i was looking for this :D

Re: Contact form telephone not required

Posted: Wed Nov 02, 2011 8:34 pm
by dan74mm
Very usefull this topic !

Re: Contact form telephone not required

Posted: Sat Feb 18, 2012 6:10 am
by thisisworldwide
You forgot to do this for the edit account pages and the guest_step_1 checkout pages

basically repeat those steps for those pages. note your coding might not be exact but just search for TELE and you should find what you need.

Re: Contact form telephone not required

Posted: Thu Apr 04, 2013 6:55 pm
by Nyte_Ryda
Hey everyone!

Just thought this might be an easier solution....

http://www.opencart.com/index.php?route ... on_id=6488

It worked for me :D
even though this thread is like 2-3 years old... :laugh:
Someone out there maybe looking for this fix too !!

Re: Contact form telephone not required

Posted: Wed Sep 04, 2013 11:29 pm
by loroverde
Nyte_Ryda wrote:Hey everyone!

Just thought this might be an easier solution....

http://www.opencart.com/index.php?route ... on_id=6488

It worked for me :D
even though this thread is like 2-3 years old... :laugh:
Someone out there maybe looking for this fix too !!
Also working for me with OpenCart 1.5.6!

Thanks a lot to William Jay!