Post by rajeshsangtiani » Mon Jun 11, 2018 11:51 pm

Hello All,

I want to add a phone field in the contact form of opencart 3.0.2.0.

How can I do it ?


Posts

Joined
Mon Apr 09, 2018 4:07 am

Post by straightlight » Mon Jun 11, 2018 11:57 pm

See this extension: https://www.opencart.com/index.php?rout ... n_id=27735 . It can be easily adapted with OC v3.x releases by using the template switcher extension from the Marketplace.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by rajeshsangtiani » Tue Jun 12, 2018 12:00 am

This is not compitable for opencart 3.0.2.0


Posts

Joined
Mon Apr 09, 2018 4:07 am

Post by DigitCart » Tue Jun 12, 2018 12:02 am

Hi,
You need to edit these files:
catalog\controller\information\contact.php
catalog\view\theme\default\template\information\contact.twig
You can learn from/duplicate the "name" field.

Also I have a commercial extension that can do this:
https://www.opencart.com/index.php?rout ... n_id=32828

Image

My Extensions / DigitCart


User avatar
Active Member
Online

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by rajeshsangtiani » Tue Jun 12, 2018 5:22 am

I was follow your instructions & successfully add phone field in contact us but when I sent inquiry to store owner I did not receive phone number in my admin email address
Kindly help me how I get customer mobile number in inquiry mail
Thanks


Posts

Joined
Mon Apr 09, 2018 4:07 am

Post by sw!tch » Tue Jun 12, 2018 10:37 am

The default contact form only sends post-> enquiry as the message body.

(e.g You can see the default $mail method is like below in the contact controller.

Code: Select all

$mail->setText($this->request->post['enquiry']);
If you want phone as well, then you need to append something like below.

Code: Select all

// Construct Message
$message = $this->request->post['enquiry']."\n"; // enquiry field here
$message .= $this->request->post['phone']."\n";  // phone here
$mail->setText($message);
The above assumes phone is required if its not required then you may need to work conditional logic in. You should probably sanitize it as well in your validate function.

Untested, backup try at your own risk.

Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Who is online

Users browsing this forum: No registered users and 10 guests