Adding new fields to the Prestashop contact form

In this tutorial, we will see how to enhance the default Prestashop contact form by adding new fields, so that it can accommodate all our needs (present and future).

Introduction

Adding new fields to the Prestashop contact form is by far a lot harder than simply throwing new inputs in the form itself. With that only, these fields would never be actually added to the thread in the database. In order to do this properly, we need to edit:

  • The contact-form.tpl template file, located in the theme folder
  • The database, to add the new field
  • The CustomerThread class (we will use an ovveride for it)
  • ContactController.php, to retrieve new data from the form
  • Message.tpl template file for the back office, to ensure new data is shown to employees as well!

 

Step 1 – The contact form

Let’s get started by editing the actual contact form. Reach your theme’s folder and open up contact-form.tpl. There is no mandatory place to add the new field to (as long as it is inside the form); I will do it right above the message textarea. As always, I am using the default theme.

Locate the following code (might be different if you are using a custom theme):

<p class="textarea">
	<label for="message">{l s='Message'}</label>
	<textarea id="message" name="message" rows="15" cols="10">{if isset($message)}{$message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea>
</p>

Right before this, add:

<p class="text">
	<label for="extrafield">{l s='Extra field'}</label>
	{if isset($customerThread.extrafield)}
		<input type="text" id="extrafield" name="extrafield" value="{$customerThread.extrafield|escape:'htmlall':'UTF-8'}" readonly="readonly" />
	{else}
		<input type="text" id="extrafield" name="extrafield" value="" />
	{/if}
</p>		

And our new field is there. Of course, it can be anything, form a custom select box, to a radio button, textarea, etc. I chose a text input.

The field is there, but our database doesn’t know. Let’s tell it! Login to the database using your favorite tool (my choice is always phpMyAdmin).Locate the ps_customer_thread table (as always, your prefix might be other than ps_).

Add a new TEXT column with no limitations. Again, if you chose something other than a text input, like a radio or checkbox, you might want to use TINYINT instead, to add only 1 or 0.

HEY! Why aren’t we doing this for the ps_customer_message?

Because I chose to add one single value for the whole thread. In this tutorial I will cover how to add fields to the thread, not single messages. But no fear, the process is quite similar, requiring you to edit the CustomerMessage class instead, and relative table.

Step 2 – Class and Controller

Our new field is there, ready to be filled in, and so is the database column. But the CustomerThread object doesn’t know about the new field, so, we need to setup a class override to account for the new field.

Go to override/classes/ and create a new file called CustomerThread.php. Open it up and fill it with the following code:



<?php

class CustomerThread extends CustomerThreadCore
{
    public $extrafield;

	public static $definition = array(
		'table' => 'customer_thread',
		'primary' => 'id_customer_thread',
		'fields' => array(
			'id_lang' => 	array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
			'id_contact' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
			'id_shop' => 	array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_customer' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_order' => 	array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
			'email' => 		array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 254),
			'token' => 		array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
			'status' => 	array('type' => self::TYPE_STRING),
			'date_add' => 	array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
			'date_upd' => 	array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
			'extrafield' => 	array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
		),
	);


}

TIP: If you are new to overrides, you might want to have a look at my other tutorial on how to properly extend Prestashop objects.

Explanation: What we did is a simple redefinition of the fields this objects accept. First, we declared our new extrafield as a public variable, and then added it to the definitions list. We set it as a string type, and a simple generic validation. Be sure you check out the correct type and validation every time you add a new field, or you might end up with unexpected results!

At this point, we also need to amend the controller that is responsible of adding such data and sending out emails. We can do the same, and use an override for this as well, but this time we need to copy and paste a whole method from the original one.

 

Go to override/controllers/front/ and create a new file named ContactController.php, the open up the original file with the same name, located in controllers/front. copy the whole _postProcess method and paste it inside the newly created file, so it looks like this:



<?php

class ContactController extends ContactControllerCore
{
	public function postProcess()
	{
		if (Tools::isSubmit('submitMessage'))
		{
			$fileAttachment = null;
			if (isset($_FILES['fileUpload']['name']) && !empty($_FILES['fileUpload']['name']) && !empty($_FILES['fileUpload']['tmp_name']))
			{
				$extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg');
				$filename = uniqid().substr($_FILES['fileUpload']['name'], -5);
				$fileAttachment['content'] = file_get_contents($_FILES['fileUpload']['tmp_name']);
				$fileAttachment['name'] = $_FILES['fileUpload']['name'];
				$fileAttachment['mime'] = $_FILES['fileUpload']['type'];
			}
			$message = Tools::getValue('message'); // Html entities is not usefull, iscleanHtml check there is no bad html tags.
			if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from))
				$this->errors[] = Tools::displayError('Invalid email address.');
			else if (!$message)
				$this->errors[] = Tools::displayError('The message cannot be blank.');
			else if (!Validate::isCleanHtml($message))
				$this->errors[] = Tools::displayError('Invalid message');
			else if (!($id_contact = (int)(Tools::getValue('id_contact'))) || !(Validate::isLoadedObject($contact = new Contact($id_contact, $this->context->language->id))))
				$this->errors[] = Tools::displayError('Please select a subject from the list provided. ');
			else if (!empty($_FILES['fileUpload']['name']) && $_FILES['fileUpload']['error'] != 0)
				$this->errors[] = Tools::displayError('An error occurred during the file-upload process.');
			else if (!empty($_FILES['fileUpload']['name']) && !in_array(substr($_FILES['fileUpload']['name'], -4), $extension) && !in_array(substr($_FILES['fileUpload']['name'], -5), $extension))
				$this->errors[] = Tools::displayError('Bad file extension');
			else
			{
				$customer = $this->context->customer;
				if (!$customer->id)
					$customer->getByEmail($from);

				$contact = new Contact($id_contact, $this->context->language->id);

				if (!((
						($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
						&& (int)Db::getInstance()->getValue('
						SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm
						WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->context->shop->id.' AND token = \''.pSQL(Tools::getValue('token')).'\'')
					) || (
						$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, (int)Tools::getValue('id_order'))
					)))
				{
					$fields = Db::getInstance()->executeS('
					SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email
					FROM '._DB_PREFIX_.'customer_thread cm
					WHERE email = \''.pSQL($from).'\' AND cm.id_shop = '.(int)$this->context->shop->id.' AND ('.
						($customer->id ? 'id_customer = '.(int)($customer->id).' OR ' : '').'
						id_order = '.(int)(Tools::getValue('id_order')).')');
					$score = 0;
					foreach ($fields as $key => $row)
					{
						$tmp = 0;
						if ((int)$row['id_customer'] && $row['id_customer'] != $customer->id && $row['email'] != $from)
							continue;
						if ($row['id_order'] != 0 && Tools::getValue('id_order') != $row['id_order'])
							continue;
						if ($row['email'] == $from)
							$tmp += 4;
						if ($row['id_contact'] == $id_contact)
							$tmp++;
						if (Tools::getValue('id_product') != 0 && $row['id_product'] == Tools::getValue('id_product'))
							$tmp += 2;
						if ($tmp >= 5 && $tmp >= $score)
						{
							$score = $tmp;
							$id_customer_thread = $row['id_customer_thread'];
						}
					}
				}
				$old_message = Db::getInstance()->getValue('
					SELECT cm.message FROM '._DB_PREFIX_.'customer_message cm
					LEFT JOIN '._DB_PREFIX_.'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
					WHERE cc.id_customer_thread = '.(int)($id_customer_thread).' AND cc.id_shop = '.(int)$this->context->shop->id.'
					ORDER BY cm.date_add DESC');
				if ($old_message == $message)
				{
					$this->context->smarty->assign('alreadySent', 1);
					$contact->email = '';
					$contact->customer_service = 0;
				}

				if ($contact->customer_service)
				{
					if ((int)$id_customer_thread)
					{
						$ct = new CustomerThread($id_customer_thread);
						$ct->status = 'open';
						$ct->id_lang = (int)$this->context->language->id;
						$ct->id_contact = (int)($id_contact);
						if ($id_order = (int)Tools::getValue('id_order'))
							$ct->id_order = $id_order;
						if ($id_product = (int)Tools::getValue('id_product'))
							$ct->id_product = $id_product;
						$ct->update();
					}
					else
					{
						$ct = new CustomerThread();
						if (isset($customer->id))
							$ct->id_customer = (int)($customer->id);
						$ct->id_shop = (int)$this->context->shop->id;
						if ($id_order = (int)Tools::getValue('id_order'))
							$ct->id_order = $id_order;
						if ($id_product = (int)Tools::getValue('id_product'))
							$ct->id_product = $id_product;
						$ct->id_contact = (int)($id_contact);
						$ct->id_lang = (int)$this->context->language->id;
						$ct->email = $from;
						$ct->status = 'open';
						$ct->token = Tools::passwdGen(12);

						$ct->add();
					}

					if ($ct->id)
					{
						$cm = new CustomerMessage();
						$cm->id_customer_thread = $ct->id;
						$cm->message = Tools::htmlentitiesUTF8($message);
						if (isset($filename) && rename($_FILES['fileUpload']['tmp_name'], _PS_MODULE_DIR_.'../upload/'.$filename))
							$cm->file_name = $filename;
						$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
						$cm->user_agent = $_SERVER['HTTP_USER_AGENT'];
						if (!$cm->add())
							$this->errors[] = Tools::displayError('An error occurred while sending the message.');
					}
					else
						$this->errors[] = Tools::displayError('An error occurred while sending the message.');
				}

				if (!count($this->errors))
				{
					$var_list = array(
									'{order_name}' => '-',
									'{attached_file}' => '-',
									'{message}' => Tools::nl2br(stripslashes($message)),
									'{email}' =>  $from,
								);

					if (isset($filename))
						$var_list['{attached_file}'] = $_FILES['fileUpload']['name'];

					$id_order = (int)Tools::getValue('id_order');
					
					if (isset($ct) && Validate::isLoadedObject($ct))
					{
						if ($ct->id_order)
							$id_order = $ct->id_order;
						$subject = sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token);
					}
					else
						$subject = Mail::l('Your message has been correctly sent');

					if ($id_order)
					{
						$order = new Order((int)$id_order);
						$var_list['{order_name}'] = $order->getUniqReference();
						$var_list['{id_order}'] = $id_order;
					}
					
					if (empty($contact->email))
						Mail::Send($this->context->language->id, 'contact_form', $subject, $var_list, $from, null, null, null, $fileAttachment);
					else
					{					
						if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
							$var_list, $contact->email, $contact->name, $from, ($customer->id ? $customer->firstname.' '.$customer->lastname : ''),
									$fileAttachment) ||
								!Mail::Send($this->context->language->id, 'contact_form', $subject, $var_list, $from, null, $contact->email, $contact->name, $fileAttachment))
									$this->errors[] = Tools::displayError('An error occurred while sending the message.');
					}
				}
				
				if (count($this->errors) > 1)
					array_unique($this->errors);
				else
					$this->context->smarty->assign('confirmation', 1);
			}
		}
	}

}


Inside this file, locate the following block of code:


if ((int)$id_customer_thread)
{
	$ct = new CustomerThread($id_customer_thread);
	$ct->status = 'open';
	$ct->id_lang = (int)$this->context->language->id;
	$ct->id_contact = (int)($id_contact);
	if ($id_order = (int)Tools::getValue('id_order'))
		$ct->id_order = $id_order;
	if ($id_product = (int)Tools::getValue('id_product'))
		$ct->id_product = $id_product;
	$ct->update();
}
else
{
	$ct = new CustomerThread();
	if (isset($customer->id))
		$ct->id_customer = (int)($customer->id);
	$ct->id_shop = (int)$this->context->shop->id;
	if ($id_order = (int)Tools::getValue('id_order'))
		$ct->id_order = $id_order;
	if ($id_product = (int)Tools::getValue('id_product'))
		$ct->id_product = $id_product;
	$ct->id_contact = (int)($id_contact);
	$ct->id_lang = (int)$this->context->language->id;
	$ct->email = $from;
	$ct->status = 'open';
	$ct->token = Tools::passwdGen(12);
	$ct->add();
}

This is responsible for creating new threads, or update current ones. Thus, the first block will update an existing customer thread, whilst the “else” one creates a new one. So, let’s tell the object it has an extrafield in both cases:


if ((int)$id_customer_thread)
{
	$ct = new CustomerThread($id_customer_thread);
	$ct->status = 'open';
	$ct->id_lang = (int)$this->context->language->id;
	$ct->id_contact = (int)($id_contact);
	if ($id_order = (int)Tools::getValue('id_order'))
		$ct->id_order = $id_order;
	if ($id_product = (int)Tools::getValue('id_product'))
		$ct->id_product = $id_product;
	$ct->extrafield = Tools::getValue('extrafield');
	$ct->update();
}
else
{
	$ct = new CustomerThread();
	if (isset($customer->id))
		$ct->id_customer = (int)($customer->id);
	$ct->id_shop = (int)$this->context->shop->id;
	if ($id_order = (int)Tools::getValue('id_order'))
		$ct->id_order = $id_order;
	if ($id_product = (int)Tools::getValue('id_product'))
		$ct->id_product = $id_product;
	$ct->id_contact = (int)($id_contact);
	$ct->id_lang = (int)$this->context->language->id;
	$ct->email = $from;
	$ct->status = 'open';
	$ct->token = Tools::passwdGen(12);
	$ct->extrafield = Tools::getValue('extrafield');
	$ct->add();
}

As you can see, we added $ct->extrafield = Tools::getValue(‘extrafield’); to both cases, just before the entries are inserted or updated.

As a last step, go to cache/ in your root folder, and delete class_index.php so that our changes take place. Now do a quick test run. If everything went smoothly, you should se the new value appear in the database.

Step 3 – Adding email variables and back office texts

We’re almost there! The system is already working, but it needs to be fine-tuned. First, in the very same ContactController, locate this block of code:


$var_list = array(
				'{order_name}' => '-',
				'{attached_file}' => '-',
				'{message}' => Tools::nl2br(stripslashes($message)),
				'{email}' =>  $from,

			);

These are the variables assigned to both the emails which will be sent out (to the customer and store owner). Let’s add our variable there!


$var_list = array(
				'{order_name}' => '-',
				'{attached_file}' => '-',
				'{message}' => Tools::nl2br(stripslashes($message)),
				'{email}' =>  $from,
				'{extrafield}' =>  (isset($ct) && $ct->extrafield) ? $ct->extrafield : ''
			);

Note: as you can see, we are first checking that the $ct variable is set, as this will not happen if a customer thread already exists!

Lastly, let’s open up the 2 email templates being sent out: contact and contact_form. You can find them in the mails/ folder, inside one of the subfolder named as your shop’s languages’ ISOs. FInd a suitable place for the new field and add

Extrafield: <strong>{extrafield}</strong>

Again, run a quick test run to ensure everything works!

email_with_new_field

 

Now, as a really last step, we will add the field to the back office as well. Again, following the maintainability principle, we will not directly modify the core files, but use overrides.

Go to your admin folder, then themes\default\template\controllers\customer_threads, and copy message.tpl. Now back to override/controllers/admin/templates, create a new folder names exactly customer_threads and paste message.tpl inside.

As always, feel free to choose any spot to add the new content. I will add it right before this:

		<dl>
			<dt>{l s='Thread ID:'}</dt>
			<dd>{$message.id_customer_thread}</dd>
		</dl>

So, before that, add

		<dl>
			<dt>{l s='Extrafield:'}</dt>
			<dd>{$message.extrafield}</dd>
		</dl>

Save & reach the admin screen, you should see the new text field appearing!

Conclusion

As you can see, a lot needs to be done for a simple addition. However, after doing it the first time it will be like second nature! Therefore, next time you’ll need to add an extra field to the contact form, you’ll already have most things settled.

You like the tuts and want to say "thank you"? Well, you can always feel free to donate:

  • Aaron Healey

    Hi,

    have followed this tutorial which works ok, except i am using a “Checkbox type” but would like it to be a “Required checkbox” – so in database i set it to a TINYINY(1) so wondered if someone could help me make it a required checkbox.

    Thanks
    Aaron

  • Kuba

    Hi. Nemo, on 1.6.18 I cannot write it to database. Everything works fine except my new columns in ps_customer_thread are empty. I suppose something changed in class, but I cannot solve it myself.
    If I add values in phpmyadmin manually – works great. But is not filled while message is sent.

  • Scandiart

    Hi Nemo I just try to fix that but without any results. so I relese this idea and erese all changes, but now my dashboard doesn’t work and I have this fail….. please help !

    “You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use
    near
    ‘3107708213,3107708213,3107708213,3107708213,1423197068,2883547224,1987151516,758’
    at line 7″

    “791. throw new PrestaShopDatabaseException($this->getMsgError().”.$sql.”);”
    in classes/db/Db.php

  • Макс Романов

    Nemo, you are the best, as always.
    How about 1.7 tutorials?

  • Alejandro Gonzalez Lopez

    Great Solution!! Thanks a lot.

  • NemoPS

    Is the extra field displaying as form input in the back office?
    If not, it might be resetting because of that

  • Usman

    Hi everything is working fine but can’t see added fields at back office followed every step carefully but futile. can you guide me further

  • Igor Dubravac

    Hello,

    Thanks for useful article.

    However, I have some problems.
    I’ve followed all steps, the fields are okay, entry to database ok, but when I receive e-mail it won’t show fields I’ve added (contact and contact_form part).
    whatever I put in there it shows me only default fields (user e-mail, message…), even if I delete those commands.

    The second problem is how to translate label names?

    Hope someone answers.

    Thanks and regards

  • Deepak Agarwal

    Hello Nemo,

    Thanks for this tutorial. I have made a custom form using this. but i am facing two issues.

    1. my form reset completely if some error is coming after submission.

    2. If i am sending mail first time then this send all information properly to email id but second time if i used same email id then only send message.

    http://darlingdazzles.com/darlingdazzles/en/contact-us

    This is my URL. please help me.

    Thanks

    • NemoPS

      Make sure you reassign the fields to the template upon submission, in any case.
      As for the second one, really hard to tell what’s going on

  • Terence Daspremont

    Hi,

    It’s possible to added Extrafield to SAV in backoffice 1.6.0.14? My extrafield is “Phone”

    everything works, except that there is no phone in the backoffice .

    Thank you

    • NemoPS

      What do you exactly mean by SAV?

  • http://iswebs.com.pl Igor

    Hi Nemo.

    I want to ask you about your article.

    This tutorial helped me in PS 1.6.0.9.
    I updated my shop to 1.6.1.1 and it stops…
    Mail are send and receive but fields are empty..

    I don’t saw any errors..
    I need help, shop is active and clients can’t contact with us!!

    • NemoPS

      Hard to tell what’s going on. DId you use overrides, or hardcoded files? In the latter, your changes have been removed, and you have to apply them again.

      • http://iswebs.com.pl Igor

        Thanks for fast answer.

        I use overrides files.

        • NemoPS

          Really odd then, some difference in the code might be preventing it from working. Did you enable dev mode? Any error?

        • SabakuBozu

          Hi Nemo, sorry to bring this up here, but I did not get a reply on the page where I asked the following (sorry igor for detracting a bit =[ )

          “I followed your steps and everything went well. However, is there a way
          to change the colors for all other pages individually? For instance, I
          changed the theme, and made my background brown, it works well with the
          homepage, but if i click on a product, the page that opens up also has a
          brown background, I want it to be white. How can I work around this?”

        • NemoPS

          SabakuBozu, could you point me to the page you mean?
          Igor, it might be hard to debug remotely, my suggestion is keeping debug mode enabled, and re-do the tut to see where it breaks

        • http://iswebs.com.pl Igor

          I will do as you say and I write back when I have the solution.

        • http://iswebs.com.pl Igor

          Hi Again Nemo,

          I created for tests new shop and I’ve done step by step your tutorial.
          Now is better than earlier but the “{extrafields}” are display in mails instead what wrote user

          Moreover, e-mails are not recorded in the database.

        • SabakuBozu

          Hi, I tried to reply with the link but i dont think it got approved. The page I am referring to is called “How to add new Color Schemes to the Prestashop 1.6 Theme”, you can find my question there as well =]

        • http://iswebs.com.pl Igor

          Yes Nemo, I had any errors, I do not know why..

          I can show you my files but they are similar to yours

  • Lucian

    Hello

    Thank you for this tutorial!I followed all the instructions above and it works just fine but I need help to insert some radio buttons into the contact form.
    What should I modify in contact-form.tpl, CustomerThread.php and contactcontroller.php.
    Thank you!

  • Pablo

    Thanks! To validate that new field, only have to add this 3 lines into override file ContactController.php

    After:
    $message = Tools::getValue(‘message’); // Html entities is not usefull, iscleanHtml check there is no bad html tags.

    Add this:
    $extrafield = Tools::getValue(‘extrafield’); // Html entities is not usefull, iscleanHtml check there is no bad html tags.

    After:
    else if (!$message)
    $this->errors[] = Tools::displayError(‘The message cannot be blank.’);

    Add this:
    else if (!$extrafield || !Validate::isInt($extrafield))
    $this->errors[] = Tools::displayError(‘Some custom text’);

  • Andres Luis Figari Berninsone

    Hello,

    I saw in the post that this works for prestashop 1.6, which is what I am running. I was able to follow your steps more than once and I keep getting the same result. The emails come in like this:

    Dirección de E-mail: client@domain.name

    Telefono: {extrafield}

    Mensaje: test b

    ID del pedido: –
    Archivo adjunto: –

    I check in mysql and i see that the table has the extra colum and upon entering my email it is there. So it is as if the value is not being passed to the email.

    in contact.html under the mail folder I have added this line:

    Telefono: {extrafield}

    What do you suppose I may have missed?

    Thank you for your excelent tutorial and help in advance.

    A

    • Andres Luis Figari Berninsone

      Correction: I tried another email that does not have an account and the telefone number is not there in the database.

      Any idea if there are different steps for 1.6? I can’t seem to get it to work and I am certain that after several tries I am not missing any steps.

      Thanks

    • Andres Luis Figari Berninsone

      Oh, I did something a little different to get it to write to the DB. Instead of putting my edits as instructed in the override version of ContactController.php I instead did it on the real one becuase the overide would not write to DB.

      • NemoPS

        Try killing the script before the email is sent, and see if $ct->extrafield is assigned, it might as well not be

  • SJ

    Hi,
    I’m using prestashop 1.6.0.14 and trying to add first and last name as 2 different fields on the contact form. I followed your instructions nothing seem to work I get an email but no first or last name.

    Went through your instructions and redid it with one field and still not working.

    I would appreciate you assistance with this.

    Thanks
    SJ

  • Franco DK West

    Hi

    Can someone explain this part to me please, new to prestashop and cant mange to sort this part out.

    The field is there, but our database doesn’t know. Let’s tell it! Login to the database using your favorite tool (my choice is always phpMyAdmin).Locate the ps_customer_thread table (as always, your prefix might be other than ps_).

    Add a new TEXT column with no limitations. Again, if you chose something other than a text input, like a radio or checkbox, you might want to use TINYINT instead, to add only 1 or 0.

    • NemoPS

      Hi there!
      Are you familiar with phpMyAdmin? You can access it from the site’s cpanel. Once there, you need to click on ps_customer_thread, then Structure, and click the button at the bottom to add a new column with the mentioned parameters

  • faccr

    Try this:

  • http://iswebs.com.pl Igor

    Hi !

    I have a little problem.

    With help yours tutorial I made new fields in contact-form for Prestashop 1.4.6.2 ( and it’s works ! ) BUT…

    Problem is when someone sending message.

    Get a error : ” Fatal error: Undefined class constant ‘self::TYPE_INT’ in localhostcontrollersContactController.php on line 190 ”

    It’s weird because email is sent and i was received it

  • hicham

    Hi, can we add input for datepicker as we do with extrafield, or there are some specification?

  • http://trendrumah.com/ sancoLgates

    Great Tuts, i’d like to try
    Thanks Nem

Store Top Sales

You like the tuts and want to say "thank you"? Well, you can always feel free to donate: