Page 1 of 1
Add telephone field to contact form [SOLVED]
Posted: Tue Jan 14, 2014 2:14 am
by krneki
I'd like to have mandatory telephone field in contact form, so customers who'd like to contact me would also have to insert their telephone number.
Would that be hard to implement?
Re: Add telephone field to contact form
Posted: Tue Jan 14, 2014 10:19 am
by pedro1993
I couldn't find an extension that does this, however you could do this:
http://forum.opencart.com/viewtopic.php?f=29&t=2648
All the best,
Peter
Re: Add telephone field to contact form
Posted: Tue Jan 14, 2014 11:11 am
by pedro1993
Sorry that link won't actually do it I misread. I will work on an extension like this starting tomorrow
Peter
Re: Add telephone field to contact form
Posted: Tue Jan 14, 2014 5:32 pm
by pprmkr
krneki wrote:I'd like to have mandatory telephone field in contact form, so customers who'd like to contact me would also have to insert their telephone number.
Would that be hard to implement?
Hardest thing is validating phone number.
Try attached vQmod, it:
- add input field to form
- checks input, allowed: digits, countrycode with () or + and digits seperated by -
- adds phonenumber to mail->text
- tested on 1.5.3.1 and 1.5.6.1
Re: Add telephone field to contact form
Posted: Tue Jan 14, 2014 6:53 pm
by krneki
Thanks a lot for this extension! I actually wouldn't even need phone number validation, but if it's there, let it be. I would just need to allow one more sign: /
So how should I edit this line?
Code: Select all
if (!preg_match('/^[\d|\+|\(]+[\)|\d|\s|-]*[\d]$/', $this->request->post['phonenumber'])) {
Are spaces between numbers allowed?
Re: Add telephone field to contact form
Posted: Tue Jan 14, 2014 7:35 pm
by pprmkr
Change into:
Code: Select all
if (!preg_match('/^[\d|\+|\(]+[\)|\d|\s|\W|-]*[\d]$/', $this->request->post['phonenumber'])) {
Added \W - Any non-word character
Re: Add telephone field to contact form
Posted: Tue Jan 14, 2014 10:24 pm
by krneki
Thanks a lot, it works perfectly fine

! What a pleasant surprise to get free support here.
Re: Add telephone field to contact form [SOLVED]
Posted: Wed Jan 15, 2014 7:49 am
by pedro1993
I'm about to start an extension where you can add contact fields

Re: Add telephone field to contact form
Posted: Thu Jan 23, 2014 5:30 am
by Gilmore
This one will add the phone number, but what people really need on the contact form is their Order Number.
http://forum.opencart.com/viewtopic.php?f=131&t=35286
IT would be nice if they started typing their name and then it would fill it out for them and let them pick an order number! Like it does in the Admin when you look for a Customer.
Re: Add telephone field to contact form [SOLVED]
Posted: Fri Jan 24, 2014 3:52 pm
by Harlekijntje
Great extension but it does not work for me...
Hope that someone can help.
I get the error: SEARCH NOT FOUND (ABORTING MOD): <b><?php echo $entry_enquiry; ?></b><br />
Thanks, Henri
Re: Add telephone field to contact form [SOLVED]
Posted: Fri Jan 24, 2014 9:55 pm
by pprmkr
Compare contact.tpl form used theme with default contact.tpl
Search for
Copy line where you find the code.
Edit xml
Code: Select all
<search position="before"><![CDATA[<b><?php echo $entry_enquiry; ?></b><br />]]></search>
Replace code
Code: Select all
<search position="before"><![CDATA[NEW_CODE_HERE]]></search>
Re: Add telephone field to contact form
Posted: Tue May 20, 2014 1:31 am
by luizeduardo
pprmkr wrote:krneki wrote:I'd like to have mandatory telephone field in contact form, so customers who'd like to contact me would also have to insert their telephone number.
Would that be hard to implement?
Hardest thing is validating phone number.
Try attached vQmod, it:
- add input field to form
- checks input, allowed: digits, countrycode with () or + and digits seperated by -
- adds phonenumber to mail->text
- tested on 1.5.3.1 and 1.5.6.1
Hi pprmkr!
Thanks for the file! It worked for me. I just got a initial error cause on the begginig i had double translation where you put version for english and dutch, this was causing a problem to not send the telephone on the message.
Well for portugue-se only i have made a change for brazilian guys.
Is on this Link:
http://www.brasilnaweb.com.br/contribui ... ormcontato
"Adicionar campo de telefone no formulário de contato"