PrestaShop

PrestaShop::Aggiungere campo contatti extra

Fare rifermento a questo articolo : http://nemops.com/adding-new-fields-to-prestashop-contact-form/#.VY1AaRPtlHw

{theme}/contact-form.tpl

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

Creare ovverride: /override/class/CustomerThread.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'),
        ),
    );
 
 
}

Inserire un campo nella tabelle ps_customer_thread

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *