Jump to content

Add news fields on the contact form (SAV)


Counya

Recommended Posts

Hi everyone, I'm currently blocked on this problem to add more fields to my contact form
1349999495_Capturedecran2022-05-21a11_39_27PM.thumb.png.da133714e67fee765521f7babb29d8e5.png 

(sorry it's in French) the second field is the field I want to add, I add on the table ps_customer_thread when the user send the message.
But when I send the message I don't have the order number in my db, I change the CustomerThread.php, contactform.php and contactform.tpl but nothing change...
 

I add my field at the end of the CustomerThread

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

I write

$nborder = trim(Tools::getValue('nborder'));

On my function sendMessage()

'{nborder}' => Tools::nl2br(Tools::htmlentitiesUTF8(Tools::stripslashes($nborder))),

and var_list on contactform.php


And add one input in my contactform.tpl

<div class="form-group row">
          <label class="col-md-3 form-control-label" for="nbcommande">N° de commande</label>
          <div class="col-md-6">
            <input
              id="nbcommande"
              class="form-control"
              name="nborder"
              type="text"
              value="{$contact.nborder}"
              placeholder="Ton numéro de commande"
            >
          </div>
        </div>


I followed lot of tutorial but nothing works...

I hope someone has the solution to my problem, thank you in advance

Have a good night/day

 

Edited by Counya (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...