pbpo Posted September 23, 2014 Share Posted September 23, 2014 (edited) jak w temacie, chciałem dodać nowe pola do formularza.Korzystałem z tego poradnika: http://www.prestashop.com/forums/topic/264731-free-tutorial-adding-new-fields-to-the-contact-form/ Problem polega na tym, że w mailu który przychodzi pola są puste. wygląda to tak: Moje pliki wyglądają tak: contact-form.tpl <p class="form-group"> <label for="id_imie">{l s='id_imie'}</label> {if isset($customerThread.id_imie)} <input class="form-control grey" type="text" id="id_imie" name="id_imie" value="{$customerThread.id_imie|escape:'htmlall':'UTF-8'}" readonly="readonly" /> {else} <input class="form-control grey validate" type="text" id="id_imie" name="id_imie" value="" /> {/if} <p>(example: Jan)</p> </p> ContactController.php 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); $ct->id_order = (int)$id_order; if ($id_product = (int)Tools::getValue('id_product')) $ct->id_product = $id_product; $ct->id_imie = Tools::getValue('id_imie'); $ct->id_nazwisko = Tools::getValue('id_nazwisko'); $ct->id_organ = Tools::getValue('id_organ'); $ct->id_adres = Tools::getValue('id_adres'); $ct->id_poczta = Tools::getValue('id_poczta'); $ct->id_miasto = Tools::getValue('id_miasto'); $ct->id_telefon = Tools::getValue('id_telefon'); $ct->update(); } else { $ct = new CustomerThread(); if (isset($customer->id)) $ct->id_customer = (int)($customer->id); $ct->id_shop = (int)$this->context->shop->id; $ct->id_order = (int)$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->id_imie = Tools::getValue('id_imie'); $ct->id_nazwisko = Tools::getValue('id_nazwisko'); $ct->id_organ = Tools::getValue('id_organ'); $ct->id_adres = Tools::getValue('id_adres'); $ct->id_poczta = Tools::getValue('id_poczta'); $ct->id_miasto = Tools::getValue('id_miasto'); $ct->id_telefon = Tools::getValue('id_telefon'); $ct->add(); } if (!count($this->errors)) { $var_list = array( '{order_name}' => '-', '{attached_file}' => '-', '{message}' => Tools::nl2br(stripslashes($message)), '{email}' => $from, '{product_name}' => '', '{id_imie}' => (isset($ct) && $ct->id_imie) ? $ct->id_imie : '', '{id_nazwisko}' => (isset($ct) && $ct->id_nazwisko) ? $ct->id_nazwisko : '', '{id_organ}' => (isset($ct) && $ct->id_organ) ? $ct->id_organ : '', '{id_adres}' => (isset($ct) && $ct->id_adres) ? $ct->id_adres : '', '{id_poczta}' => (isset($ct) && $ct->id_poczta) ? $ct->id_poczta : '', '{id_miasto}' => (isset($ct) && $ct->id_miasto) ? $ct->id_miasto : '', '{id_telefon}' => (isset($ct) && $ct->id_telefon) ? $ct->id_telefon : '', ); CustomerThread.php <?php class CustomerThread extends CustomerThreadCore { public $id_imie; public $id_nazwisko; public $id_organ; public $id_adres; public $id_poczta; public $id_miasto; public $id_telefon; 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), 'id_imie' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 50, 'required' => true), 'id_nazwisko' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 50, 'required' => true), 'id_organ' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255, 'required' => true), 'id_adres' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255, 'required' => true), 'id_poczta' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 15, 'required' => true), 'id_miasto' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 30, 'required' => true), 'id_telefon' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 15, 'required' => true), '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'), ), ); } i message.tpl {if !$email} <dl class="dl-horizontal"> <dt>{l s='id_imie:'}</dt> <dd>{$message.id_imie}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='id_nazwisko:'}</dt> <dd>{$message.id_nazwisko}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='id_organ:'}</dt> <dd>{$message.id_organ}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='id_adres:'}</dt> <dd>{$message.id_adres}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='id_poczta:'}</dt> <dd>{$message.id_poczta}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='id_miasto:'}</dt> <dd>{$message.id_miasto}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='id_telefon:'}</dt> <dd>{$message.id_telefon}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='Thread ID:'}</dt> <dd>{$message.id_customer_thread}</dd> </dl> <dl class="dl-horizontal"> <dt>{l s='Message ID:'}</dt> <dd>{$message.id_customer_message}</dd> </dl>{/if} No i oczywiście w phpmyadmin dodałem : Edited September 23, 2014 by pbpo (see edit history) Link to comment Share on other sites More sharing options...
pbpo Posted September 23, 2014 Author Share Posted September 23, 2014 Nie wiem dlaczego, ale kiedy zamieniłem moje id (id_imie / id_nazwisko itd) na EXTRAFIELD wszystko zaczeło działać poprawnie .... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now