Jump to content

Trafiquant

Members
  • Posts

    119
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Trafiquant's Achievements

Newbie

Newbie (1/14)

10

Reputation

  1. Merci pour la réponse. Pour Prestashop 1.7.2 on arrive à forcer ce fonctionnement avec le même type d'override. Il faut créer le fichier /override/controllers/front/AttachmentController.php et y overrider la fonction postProcess de la sorte : class AttachmentController extends AttachmentControllerCore { public function postProcess() { $a = new Attachment(Tools::getValue('id_attachment'), $this->context->language->id); if (!$a->id) { Tools::redirect('index.php'); } Hook::exec('actionDownloadAttachment', array('attachment' => &$a)); if (ob_get_level() && ob_get_length() > 0) { ob_end_clean(); } header('Content-Transfer-Encoding: binary'); header('Content-Type: '.$a->mime); header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file)); header('Content-Disposition: inline; filename="'.utf8_decode($a->file_name).'"'); @set_time_limit(0); self::readfileChunked(_PS_DOWNLOAD_DIR_.$a->file); exit; } } Et effectivement, bien penser à vider les caches smarty + navigateur.
  2. Je suis intéressé par un tel module si @doekia a des liens à communiquer. Tout ce que j'ai pu trouver jusqu'à présent n'assure pas la correspondance des balises hreflang entre des pages de multi-boutiques différentes.
  3. Salut Julien, Décidément toutes les recherches sur le sujet mènent à toi... Ton tuto est super, mais un détail m'empêche de l'appliquer : je suis sous Prestashop 1.7 ! Aurais-tu par hasard une idée de comment adapter ta méthode à Prestashop 1.7 ?
  4. Hi @ndiaga, Thanks for your reply : Unfortunatly, this one doesn't work. Seems that the correct function is getManufacturerLink instead of getmanufacturerLink, but same result. Seems that $manufacturer is not initialized.
  5. The topic name mentions that we're looking for a solution for Prestashop 1.7 !
  6. OK, I didn't see this little detail: But I have a question about link generated: how can I do to get the rewritten link instead of /index.php?id_manufacturer=13&controller=manufacturer&id_lang= This kind of link is not good for SEO and indexation by search engines.
  7. @ndiaga I tried your module, and manufacturer logo doesn't display on my products lists pages... Is your addon compatible with Prestashop 1.7.1.2 ?
  8. Hi, I tried this on my shop : {if isset($product.id_manufacturer)} <div class="product-brand"> {block name='product_brand'} <a href="{$link->getManufacturerLink($product.id_manufacturer)}" title="{$product.manufacturer_name|escape:html:'UTF-8'}"> <img src="{$link->getManufacturerImageLink($product.id_manufacturer, 'small_default')}" alt="{$product.manufacturer_name|escape:html:'UTF-8'}"> </a> {/block} </div> {/if} I applied this code on the /themes/MYTHEME/templates/catalog/_partials/miniatures/product.tpl file. Display seems good, but I'm not sure about code integrity: I tried to adapt some code founded on topics related to Prestashop 1.6.
  9. Seems that you need to delete the /app/cache folder. It was the solution for me.
  10. Same issue here. Edit: Seems that you need to delete the /app/cache folder. It was the solution for me.
  11. You can override the StoresController.php in directory /override/controllers/front/ ; I think it's a better idea to not lose this hack in case of minor Prestashop update.
  12. Le problème a été remonté à 202commerce voire à Prestashop ? Qu'en est-il si l'on "déhooke" le module du hook backofficeheader ?
  13. Bonjour à tous, Un grand merci à @eve20100 dont j'ai pu retrouver toutes les interventions sur ce même sujet, en Français et en Anglais (SVP ! ) et qui m'a aidé à trouver la solution pour contrer la politique MailJet, qui se refuse d'implémenter un système de filtrage des mails envoyés par la boutique. Dans la mesure où sa réponse m'a aidé, 3 ans plus tard, à mettre en place les modifications pour un Prestashop 1.5.6.0, je vous propose de trouver ci-après les overrides que j'ai pu créer dans le dossier /override/controllers/front : ContactController.php (voir lignes 167, 171, 173) : <?php class ContactController extends ContactControllerCore { /** * 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'); $fileAttachment = 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.'); else if (!$message) $this->errors[] = Tools::displayError('The message cannot be blank.'); else if (!Validate::isCleanHtml($message)) $this->errors[] = Tools::displayError('Invalid message'); else if (!($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. '); else if (!empty($fileAttachment['name']) && $fileAttachment['error'] != 0) $this->errors[] = Tools::displayError('An error occurred during the file-upload process.'); else if (!empty($fileAttachment['name']) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -4)), $extension) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -5)), $extension)) $this->errors[] = Tools::displayError('Bad file extension'); else { $customer = $this->context->customer; if (!$customer->id) $customer->getByEmail($from); $contact = new Contact($id_contact, $this->context->language->id); 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, (int)Tools::getValue('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)(Tools::getValue('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 && Tools::getValue('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); if ($id_order = (int)Tools::getValue('id_order')) $ct->id_order = $id_order; if ($id_product = (int)Tools::getValue('id_product')) $ct->id_product = $id_product; $ct->update(); } else { $ct = new CustomerThread(); if (isset($customer->id)) $ct->id_customer = (int)($customer->id); $ct->id_shop = (int)$this->context->shop->id; if ($id_order = (int)Tools::getValue('id_order')) $ct->id_order = $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->add(); } if ($ct->id) { $cm = new CustomerMessage(); $cm->id_customer_thread = $ct->id; $cm->message = $message; if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename']))) $cm->file_name = $fileAttachment['rename']; $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); $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}' => '', ); if (isset($fileAttachment['name'])) $var_list['{attached_file}'] = $fileAttachment['name']; $id_order = (int)Tools::getValue('id_order'); $id_product = (int)Tools::getValue('id_product'); if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) $id_order = $ct->id_order; if ($id_order) { $order = new Order((int)$id_order); $var_list['{order_name}'] = $order->getUniqReference(); $var_list['{id_order}'] = $id_order; } 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, '[email protected]', null, null, null, $fileAttachment); else { if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', $var_list, $contact->email, $contact->name, '[email protected]', ($customer->id ? $customer->firstname.' '.$customer->lastname : ''), $fileAttachment) || !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, '[email protected]', null, $contact->email, $contact->name, $fileAttachment)) $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } if (count($this->errors) > 1) array_unique($this->errors); else $this->context->smarty->assign('confirmation', 1); } } } } OrderDetailController.php (voir ligne 68) : <?php class OrderDetailController extends OrderDetailControllerCore { /** * Start forms process * @see FrontController::postProcess() */ public function postProcess() { if (Tools::isSubmit('submitMessage')) { $idOrder = (int)(Tools::getValue('id_order')); $msgText = Tools::getValue('msgText'); if (!$idOrder || !Validate::isUnsignedId($idOrder)) $this->errors[] = Tools::displayError('The order is no longer valid.'); elseif (empty($msgText)) $this->errors[] = Tools::displayError('The message cannot be blank.'); elseif (!Validate::isMessage($msgText)) $this->errors[] = Tools::displayError('This message is invalid (HTML is not allowed).'); if (!count($this->errors)) { $order = new Order($idOrder); if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) { //check if a thread already exist $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($this->context->customer->email, $order->id); $cm = new CustomerMessage(); if (!$id_customer_thread) { $ct = new CustomerThread(); $ct->id_contact = 0; $ct->id_customer = (int)$order->id_customer; $ct->id_shop = (int)$this->context->shop->id; if (($id_product = (int)Tools::getValue('id_product')) && $order->orderContainProduct((int)$id_product)) $ct->id_product = $id_product; $ct->id_order = (int)$order->id; $ct->id_lang = (int)$this->context->language->id; $ct->email = $this->context->customer->email; $ct->status = 'open'; $ct->token = Tools::passwdGen(12); $ct->add(); } else $ct = new CustomerThread((int)$id_customer_thread); $cm->id_customer_thread = $ct->id; $cm->message = $msgText; $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); $cm->add(); if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) $to = strval(Configuration::get('PS_SHOP_EMAIL')); else { $to = new Contact((int)(Configuration::get('PS_MAIL_EMAIL_MESSAGE'))); $to = strval($to->email); } $toName = strval(Configuration::get('PS_SHOP_NAME')); $customer = $this->context->customer; if (Validate::isLoadedObject($customer)) Mail::Send($this->context->language->id, 'order_customer_comment', Mail::l('Message from a customer'), array( '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{email}' => '[email protected]', '{id_order}' => (int)($order->id), '{order_name}' => $order->getUniqReference(), '{message}' => Tools::nl2br($msgText) ), $to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname); if (Tools::getValue('ajax') != 'true') Tools::redirect('index.php?controller=order-detail&id_order='.(int)$idOrder); $this->context->smarty->assign('message_confirmation', true); } else $this->errors[] = Tools::displayError('Order not found'); } } } } En espérant que cela puisse servir à quelqu'un. ++
  14. Bonjour, Allez voir du côté des traductions module, en particulier le module Informations client, vous devriez y trouver votre bonheur.
  15. En revanche, une solution qui fonctionne quelle que soit la version PS : http://www.lije-creative.com/noindex-page-prestashop/
×
×
  • Create New...