calrou Posted October 31, 2020 Share Posted October 31, 2020 Bonjour, Je souhaite bloquer l'envoi d'emails Prestashop pour des ventes marketplaces. Pour cela, j'ai crée des états de commande spécifiques où j'ai désactivé l'envoi des emails et ça fonctionne PAr contre, dès que je saisis un numéro de suivi dans la commande, un email est envoyé avec l'objet : [NOM DU SITE] Livraison en cours Je ne trouve pas comment le désactiver, vous pourriez m'aider ? J'utilise Prestashop : 1.7.6.8 Merci par avance, Prenez soin de vous, Rémy Link to comment Share on other sites More sharing options...
Eolia Posted October 31, 2020 Share Posted October 31, 2020 C'est en dur dans le controleur AdminOrder.php, il faut commenter la fonction. Link to comment Share on other sites More sharing options...
calrou Posted October 31, 2020 Author Share Posted October 31, 2020 Bonsoir @Eolia Merci, je vais aller regarder... par contre ce sera écrasé à la prochaine MAJ ? Bonne soirée, Link to comment Share on other sites More sharing options...
Eolia Posted October 31, 2020 Share Posted October 31, 2020 faites un override Link to comment Share on other sites More sharing options...
calrou Posted October 31, 2020 Author Share Posted October 31, 2020 Je pense que j'ai trouvé, mais dès que je commente la fonction, j'ai une erreur 500. Est-ce que vous avez une idée de ce que je fais mal ? Merci :) // Update order_carrier $order_carrier->tracking_number = pSQL($tracking_number); if ($order_carrier->update()) { //send mail only if tracking number is different AND not empty if (!empty($tracking_number) && $old_tracking_number != $tracking_number) { if ($order_carrier->sendInTransitEmail($order)) { $customer = new Customer((int) $order->id_customer); $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); Hook::exec('actionAdminOrdersTrackingNumberUpdate', array( 'order' => $order, 'customer' => $customer, 'carrier' => $carrier, ), null, false, true, false, $order->id_shop); Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token); } else { $this->errors[] = $this->trans('An error occurred while sending an email to the customer.', array(), 'Admin.Orderscustomers.Notification'); } } } else { $this->errors[] = $this->trans('The order carrier cannot be updated.', array(), 'Admin.Orderscustomers.Notification'); } } } else { $this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error'); } } elseif (Tools::isSubmit('submitState') && isset($order)) { Link to comment Share on other sites More sharing options...
Eolia Posted October 31, 2020 Share Posted October 31, 2020 je ne vois pas vos commentaires là ? Link to comment Share on other sites More sharing options...
calrou Posted October 31, 2020 Author Share Posted October 31, 2020 En effet, j'ai copié collé le code d'origine. Voici les modifications que j'ai tenté : // Update order_carrier $order_carrier->tracking_number = pSQL($tracking_number); if ($order_carrier->update()) { //send mail only if tracking number is different AND not empty if (!empty($tracking_number) && $old_tracking_number != $tracking_number) { // if ($order_carrier->sendInTransitEmail($order)) { // $customer = new Customer((int) $order->id_customer); // $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); Hook::exec('actionAdminOrdersTrackingNumberUpdate', array( 'order' => $order, 'customer' => $customer, 'carrier' => $carrier, ), null, false, true, false, $order->id_shop); Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token); } else { $this->errors[] = $this->trans('An error occurred while sending an email to the customer.', array(), 'Admin.Orderscustomers.Notification'); } } } else { $this->errors[] = $this->trans('The order carrier cannot be updated.', array(), 'Admin.Orderscustomers.Notification'); } } } else { $this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error'); } } elseif (Tools::isSubmit('submitState') && isset($order)) { Link to comment Share on other sites More sharing options...
Eolia Posted October 31, 2020 Share Posted October 31, 2020 En effet c'est un peu n'importe quoi^^ Mettez ça à la place // Update order_carrier $order_carrier->tracking_number = pSQL($tracking_number); if ($order_carrier->update()) { //send mail only if tracking number is different AND not empty /*if (!empty($tracking_number) && $old_tracking_number != $tracking_number) { if ($order_carrier->sendInTransitEmail($order)) { $customer = new Customer((int) $order->id_customer); $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); Hook::exec('actionAdminOrdersTrackingNumberUpdate', array( 'order' => $order, 'customer' => $customer, 'carrier' => $carrier, ), null, false, true, false, $order->id_shop); Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token); } else { $this->errors[] = $this->trans('An error occurred while sending an email to the customer.', array(), 'Admin.Orderscustomers.Notification'); } }*/ } else { $this->errors[] = $this->trans('The order carrier cannot be updated.', array(), 'Admin.Orderscustomers.Notification'); } } } else { $this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error'); } } elseif (Tools::isSubmit('submitState') && isset($order)) { - Si vous commentez en mode ligne des if(....) { il faut commenter les accolades fermantes } - inutile de laisser tourner le hook si vous désirez que l'ajout du n° de suivi reste transparent. Link to comment Share on other sites More sharing options...
calrou Posted October 31, 2020 Author Share Posted October 31, 2020 Merci de votre aide 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