Jump to content

Search the Community

Showing results for tags 'nouveau champs'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community Help and Support
    • PrestaShop Download
    • PrestaShop Marketplace
  • News and Announcements
    • PrestaShop news and releases
    • PrestaShop Beta
    • PrestaShop Blogs
    • PrestaShop Meetups
  • International community (English)
    • General topics
    • PrestaShop Merchants
    • PrestaShop Developers
    • Taxes, Translations & Laws
    • Community Modules and Themes
  • Forum francophone
    • Discussion générale
    • Aide et support communautaire
    • PrestaShop pour les marchands
    • PrestaShop pour les développeurs
    • Adaptation aux lois Québécoises
    • Modules et thèmes gratuits
    • Modules et thèmes payants
  • Foro en Español
    • Discusión general
    • Soporte de la comunidad y ayuda
    • Comerciantes PrestaShop
    • Desarrolladores PrestaShop
    • Módulos y plantillas gratuitas
  • Forum italiano
    • Forum generale
    • Aiuto e supporto della Community
    • Commercianti PrestaShop
    • Sviluppatori PrestaShop
    • Aspetti legali sull'eCommerce
    • Moduli e template gratuiti
  • Deutsches Forum
    • Generelle Fragen
    • Support und Hilfe aus der Community
    • e-Commerce/Versand-Handel mit Prestashop
    • Prestashop-Entwickler
    • Anpassung an deutsches Recht
    • Kostenlose Module und Templates
    • Generelle Fragen Copy
  • Nederlandstalig forum
    • Algemeen
    • Hulp en ondersteuning, van en voor de community
    • PrestaShop-winkeliers
    • PrestaShop-ontwikkelaars
    • Het aanpassen van PrestaShop
    • Gratis modules en templates
  • Fórum em Português
    • Fórum Geral
    • Ajuda e Suporte da Comunidade
    • Lojistas que utilizam o PrestaShop
    • Desenvolvedores PrestaShop
    • Legislação específica
    • Módulos e temas gratuitos
  • Polskie forum
    • Forum ogólne
    • Wsparcie i pomoc użytkowników
    • Oferty twórców PrestaShop
    • Deweloperzy PrestaShop
    • Darmowe Moduły i Szablony
  • Dansk forum
    • Generelt forum
    • Hjælp og support fra fællesskabet
    • PrestaShop for købmænd
    • PrestaShop for udviklere
    • Love og regler
    • Gratis moduler og temaer
  • České fórum
    • Instalasi, Konfigurasi dan upgrade
    • Obecná diskuze
    • Bezplatné moduly a šablony
    • PrestaShop vývojáři
    • PrestaShop obchodníci
  • Bahasa Indonesia
    • Diskusi Umum
    • Podpora a pomoc komunity
    • Laporan Bug
    • Jasa, Promosi & Lowongan Kerja
  • Svenskt forum
    • Allmän diskussion
    • Installation, konfigurering och uppdatering
  • Forumul românesc
    • Discuţii generale
    • Instalare, configurare şi upgrade
  • Pусский язык
    • Обсуждение скрипта
    • Установка, Настройка, Обновление
    • Прием багов
  • Slovenské fórum
    • Všeobecná diskusia
    • Podpora a pomoc komunity
    • PrestaShop obchodníci
    • PrestaShop vývojári
    • Bezplatné moduly a šablóny
  • Türkçe Topluluğu
    • Genel Konular
    • Topluluk desteği ve yardım
    • PrestaShop Tüccarları
    • Prestashop Geliştiricileri
    • Ücretsiz Modül ve Temalar
  • Diễn đàn tiếng Việt
    • Thảo luận chung
    • Hỗ trợ từ cộng đồng
    • Dành cho chủ doanh nghiệp / cửa hàng
    • Dành cho lập trình viên
  • PrestaShop Communities
    • اللغه العربيه [Arabic]
    • Ελληνικά [Greek]
    • עִבְרִית [Hebrew]
    • 中文
    • Magyar [Hungarian]
    • 日本語 [Japanese]
    • Lietuviškai [Lithuanian]
    • انجمن فارسی [Persian]
    • ไทย [Thai]
    • Malaysia [Malaysian]
    • Eesti [Estonian]
    • Slovenščina [Slovenian]
    • Српски [Serbian]
  • IP. Board Forum
    • IP. Board Forum Questions and Issues
  • Archive
    • Zapłać Moduły i Szablony [ARCHIVE]
    • Moduly, upravy a dizajn [ARCHIVE]
    • Phát triển và các mô-đun [ARCHIVE]
    • Yazılım, Modül ve Tema [ARCHIVE]
    • Модули, Шаблоны [ARCHIVE]
    • Module şi teme [ARCHIVE]
    • Pengembangan dan Modul [ARCHIVE]
    • Moduler och teman [ARCHIVE]
    • Ecommerce x PrestaShop [ARCHIVE BOARD]
    • Vývoj a moduly [ARCHIVE]
    • Kostenpflichtige Module, Templates [ARCHIVE]
    • Módulos y temas pagos [ARCHIVE]
    • Módulos e temas pagos [ARCHIVE]
    • Servizi commerciali [ARCHIVE]
    • Forum - Feedback Contributor
    • PrestaShop Cloud

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. salut , je veux ajouter deux inputs pour mon formulaire de contact , les récupérer dans la Template mail reçue , pour cela j'ai suivi le tutoriel de @NemoPs , au niveau de ma base de donnée les champs ajoutés sont vides et pour la Template mail j'ai pas les valeurs des champs. quelle est le problème s'il vous plaît ?? une idée voici les modifications que j'ai fait : -ajout de deux champs au niveau les tables ps_customer_thread et ps_customer_message - faire override pour CustomerThread.php et ContactController.php -modification contactform.tpl et les fichiers contact.html au niveau dossier mails. <?php class CustomerThread extends CustomerThreadCore { public $extrafield; public $extrafield2; public $id; public $id_shop; public $id_lang; public $id_contact; public $id_customer; public $id_order; public $id_product; public $status; public $email; public $token; public $date_add; public $date_upd; /** * @see ObjectModel::$definition */ 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'), 'extrafield2' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), ), ); } contactController.php <?php class ContactController extends ContactControllerCore { public $php_self = 'contact'; public $ssl = true; /** * Start forms process * @see FrontController::postProcess() */ public function postProcess() { if (Tools::isSubmit('submitMessage')) { $extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg'); $file_attachment = Tools::fileAttachment('fileUpload'); $message = Tools::getValue('message'); // Html entities is not usefull, iscleanHtml check there is no bad html tags. if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) { $this->errors[] = Tools::displayError('Invalid email address.'); } elseif (!$message) { $this->errors[] = Tools::displayError('The message cannot be blank.'); } elseif (!Validate::isCleanHtml($message)) { $this->errors[] = Tools::displayError('Invalid message'); } elseif (!($id_contact = (int)Tools::getValue('id_contact')) || !(Validate::isLoadedObject($contact = new Contact($id_contact, $this->context->language->id)))) { $this->errors[] = Tools::displayError('Please select a subject from the list provided. '); } elseif (!empty($file_attachment['name']) && $file_attachment['error'] != 0) { $this->errors[] = Tools::displayError('An error occurred during the file-upload process.'); } elseif (!empty($file_attachment['name']) && !in_array(Tools::strtolower(substr($file_attachment['name'], -4)), $extension) && !in_array(Tools::strtolower(substr($file_attachment['name'], -5)), $extension)) { $this->errors[] = Tools::displayError('Bad file extension'); } else { $customer = $this->context->customer; if (!$customer->id) { $customer->getByEmail($from); } $id_order = (int)$this->getOrder(); if (!(( ($id_customer_thread = (int)Tools::getValue('id_customer_thread')) && (int)Db::getInstance()->getValue(' SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->context->shop->id.' AND token = \''.pSQL(Tools::getValue('token')).'\'') ) || ( $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, $id_order) ))) { $fields = Db::getInstance()->executeS(' SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email FROM '._DB_PREFIX_.'customer_thread cm WHERE email = \''.pSQL($from).'\' AND cm.id_shop = '.(int)$this->context->shop->id.' AND ('. ($customer->id ? 'id_customer = '.(int)$customer->id.' OR ' : '').' id_order = '.(int)$id_order.')'); $score = 0; foreach ($fields as $key => $row) { $tmp = 0; if ((int)$row['id_customer'] && $row['id_customer'] != $customer->id && $row['email'] != $from) { continue; } if ($row['id_order'] != 0 && $id_order != $row['id_order']) { continue; } if ($row['email'] == $from) { $tmp += 4; } if ($row['id_contact'] == $id_contact) { $tmp++; } if (Tools::getValue('id_product') != 0 && $row['id_product'] == Tools::getValue('id_product')) { $tmp += 2; } if ($tmp >= 5 && $tmp >= $score) { $score = $tmp; $id_customer_thread = $row['id_customer_thread']; } } } $old_message = Db::getInstance()->getValue(' SELECT cm.message FROM '._DB_PREFIX_.'customer_message cm LEFT JOIN '._DB_PREFIX_.'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread) WHERE cc.id_customer_thread = '.(int)$id_customer_thread.' AND cc.id_shop = '.(int)$this->context->shop->id.' ORDER BY cm.date_add DESC'); if ($old_message == $message) { $this->context->smarty->assign('alreadySent', 1); $contact->email = ''; $contact->customer_service = 0; } 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->extrafield = Tools::getValue('extrafield'); $ct->extrafield2 = Tools::getValue('extrafield2'); $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->extrafield = Tools::getValue('extrafield'); $ct->extrafield2 = Tools::getValue('extrafield2'); $ct->add(); } if ($ct->id) { $cm = new CustomerMessage(); $cm->id_customer_thread = $ct->id; $cm->message = $message; if (isset($file_attachment['rename']) && !empty($file_attachment['rename']) && rename($file_attachment['tmp_name'], _PS_UPLOAD_DIR_.basename($file_attachment['rename']))) { $cm->file_name = $file_attachment['rename']; @chmod(_PS_UPLOAD_DIR_.basename($file_attachment['rename']), 0664); } $cm->ip_address = (int)ip2long(Tools::getRemoteAddr()); $cm->user_agent = $_SERVER['HTTP_USER_AGENT']; if (!$cm->add()) { $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } else { $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } if (!count($this->errors)) { $var_list = array( '{order_name}' => '-', '{attached_file}' => '-', '{message}' => Tools::nl2br(stripslashes($message)), '{email}' => $from, '{product_name}' => '', '{extrafield}' => (isset($ct) && $ct->extrafield) ? $ct->extrafield : '' , '{extrafield2}' => (isset($ct) && $ct->extrafield2) ? $ct->extrafield2 : '' , ); if (isset($file_attachment['name'])) { $var_list['{attached_file}'] = $file_attachment['name']; } $id_product = (int)Tools::getValue('id_product'); if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) { $order = new Order((int)$ct->id_order); $var_list['{order_name}'] = $order->getUniqReference(); $var_list['{id_order}'] = (int)$order->id; } if ($id_product) { $product = new Product((int)$id_product); if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) { $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; } } if (empty($contact->email)) { Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment); } else { if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', $var_list, $contact->email, $contact->name, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from) || !Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $contact->email)) { $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } } if (count($this->errors) > 1) { array_unique($this->errors); } elseif (!count($this->errors)) { $this->context->smarty->assign('confirmation', 1); } } } } } modification contactForm.tpl <p class="form-group"> <label for="extrafield">{l s='Nom'}</label> {if isset($customerThread.extrafield)} <input class="form-control grey" type="text" id="extrafield" name="extrafield" value="{$customerThread.extrafield|escape:'html':'UTF-8'}" /> {else} <input class="form-control grey validate" type="text" id="extrafield" name="extrafield" data-validate="isGenericName" value="{$customerThread.extrafield|escape:'html':'UTF-8'}" /> {/if} </p> <p class="form-group"> <label for="extrafield2">{l s='Prénom'}</label> {if isset($customerThread.extrafield2)} <input class="form-control grey" type="text" id="extrafield2" name="extrafield2" value="{$customerThread.extrafield2|escape:'html':'UTF-8'}" /> {else} <input class="form-control grey validate" type="text" id="extrafield2" name="extrafield2" data-validate="isGenericName" value="{$customerThread.extrafield2|escape:'html':'UTF-8'}" /> {/if} </p> contactform.html <span style="color:#777"> Votre message a bien été envoyé à notre service client.<br /><br /> <span style="color:#333"><strong>Message :</strong></span> {message}<br /><br /> <span style="color:#333"><strong>Commande # :</strong></span> {order_name}<br /> <span style="color:#333"><strong>Produit :</strong></span> {product_name}<br /> <span style="color:#333"><strong>Pièce jointe :</strong></span> {attached_file} <br /> <span style="color:#333"><strong>Nom:</strong></span> {extrafield} <br /> <span style="color:#333"><strong>Prénom :</strong></span> {extrafield2} <br /> </span> champs au niveau base donnée pourquoi les champs ajoutés extrafield et extrafield2 sont vides au niveau BD et et template mail?
×
×
  • Create New...