title: Display custom fields in registration form Prestashop 1.6.x
body: <p>I added a module in Ps 1.6. which creates Electronic Invoice. This module adds in the registration form two fields but I'm not able to fetch and update data from the db.</p>
  
  <p>Here below some snippets.
  First I create the table:</p>
  
  <pre><code>    $sqlInstallCod = 'ALTER TABLE ' ._DB_PREFIX_.'customer ADD codice_destinatario VARCHAR(255) DEFAULT NULL';
  
      Db::getInstance()-&gt;execute($sqlInstallCod);
      $sqlInstallPec = 'ALTER TABLE ' ._DB_PREFIX_.'customer ADD pec VARCHAR(255) DEFAULT NULL';
  
      Db::getInstance()-&gt;execute($sqlInstallPec);
  </code></pre>
  
  <p>Then I try to render data in my registration form by means of the functions below:</p>
  
  <pre><code>public function hookDisplayCustomerAccountForm($params){
  $query = 'SELECT codice_destinatario FROM '._DB_PREFIX_.'customer WHERE id_customer=\'' . $params['id_customer']. '\';';
  
  
  $this-&gt;context-&gt;smarty-&gt;assign('codice_destinatario', '');
  $this-&gt;context-&gt;smarty-&gt;assign('pec', '');
  return $this-&gt;display(__FILE__, 'hookDisplayCustomerAccountForm.tpl');
  } 
  
  public function hookDisplayCustomerIdentityForm($params){
  $query = 'SELECT codice_destinatario FROM '._DB_PREFIX_.'customer WHERE id_customer=\'' . $order_id . '\';';
  
  $this-&gt;trace("id_customer",$params['id_customer']);
  
  $query = 'SELECT codice_destinatario FROM &gt;'._DB_PREFIX_.'customer WHERE id_customer=\'' . $params['id_customer']. '\';';
  
  
  $this-&gt;context-&gt;smarty-&gt;assign('codice_destinatario', '');
  $this-&gt;context-&gt;smarty-&gt;assign('pec', '');
  
  return $this-&gt;display(__FILE__, 'hookDisplayCustomerAccountForm.tpl');
  } 
  </code></pre>
  
  <p>Actually the data is saved in the correct table but neither displayed in front-end nor updated.</p>
  
  <p>I think I need to change also my hookDisplayCustomerAccountForm.tpl file. I tried to do this:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label for="codice_destinatario"&gt;{l s='Codice Destinatario' mod='fattura24'}&lt;/label&gt;
      &lt;input class="form-control" name="codice_destinatario" type="text" id="codice_destinatario" value="{if isset($smarty.post.codice_destinatario)}{$smarty.post.codice_destinatario|escape:'htmlall':'UTF-8'}{/if}"/&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;label for="pec"&gt;{l s='PEC' mod='fattura24'}&lt;/label&gt;
      &lt;input class="form-control" name="pec" type="text" id="pec" value="{if isset($smarty.post.pec)}{$smarty.post.pec|escape:'htmlall':'UTF-8'}{/if}"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It doesn't work. Any suggestions?
  Thanks a lot
  David</p>