Jump to content

Cutomizing contact form: How to add telephone field in customer data


Recommended Posts


I´ve added a phone number field in the contact form, but I don´t know how to I include it as new field in the customer information, for now I included it as part of the message, but I would like to store it as a separate field.

Please, can you let me know how can I do that?



This is what I have done:

First, edited mytheme  contactform.tpl

        <div class="form-group row">
          <label class="col-md-3 form-control-label">{l s='Phone' d='Shop.Forms.Labels'}</label>
            <div class="col-md-6">
                <input class="form-control" name="phone" placeholder="600 000 000">


then I edited modules/contactform/contactform.php to include the phone information as part of the message, but what I want to do I so store this info "Tools::getValue('phone')"  as separate field in the customer information.

 public function sendMessage()
        $extension = ['.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg'];
        $file_attachment = Tools::fileAttachment('fileUpload');
        $message =  $this->l('Teléfono:' ). ' ' . trim(Tools::getValue('phone')). '<br/>' . trim(Tools::getValue('message'));
        $url = Tools::getValue('url');
        $clientToken = Tools::getValue('token');
        $serverToken = $this->context->cookie->contactFormToken;
        $clientTokenTTL = $this->context->cookie->contactFormTokenTTL;


Thank you

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...