kandalf Posted December 6, 2015 Share Posted December 6, 2015 I'm on Prestashop 1.6.1.2, and everytime I set a tracking number an emails is automatically sent, I want to stop this email and sent the tracking code on the "shipping" email. I can't find any settings that enable me to deactivate the "in transit" emails. Link to comment Share on other sites More sharing options...
socialcowboy Posted December 22, 2015 Share Posted December 22, 2015 Same question for me! Link to comment Share on other sites More sharing options...
HavanA Posted December 23, 2015 Share Posted December 23, 2015 I am not 100% sure, but possibly you can set your preferences here: http://prntscr.com/9hqk7v ? Link to comment Share on other sites More sharing options...
serdib Posted December 25, 2015 Share Posted December 25, 2015 Disabling checkbox for "Processing in progress" status (Preparation template) will NOT help you. To disable this In-Transit-email you should make some code editing (see screen). Just comment this lines in /controllers/admin/AdminOrdersController.php file. Just don't ask me why developers didn't make this option for backoffice. I wish i knew. 1 Link to comment Share on other sites More sharing options...
Rynraf Posted March 13, 2017 Share Posted March 13, 2017 I was searching solution for this question and I found this topic. And after checking this clues I would like to describe what I had change. I can't open this screenshot put by serdib. I have Prestashop 1.6.0.14 and in this mentioned file /controllers/admin/AdminOrdersController.php just try to find this string: /* Update shipping number */ Below there are few lines of code responsible for sending email notification after setting tracking number. You shuold comment part of it. This lines starts in my verion from line 480. Finaly it should look like this: /* if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { */ 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[] = Tools::displayError('An error occurred while sending an email to the customer.'); */ Please be careful, because I didn't comment all this part of code. Un the middle there are still twa lines not commented. I checked this and it works What else? I prepared new email template and new order status - "prepared to send". In this email message I put info about tracking URL: You can track your package using the following link: <a href="{followup}" style="color:#337ff1">{followup}</a> Link to comment Share on other sites More sharing options...
Vito Posted December 31, 2017 Share Posted December 31, 2017 It is a bit different for PS 1.7.2+ versions. As mentioned above you should change the file .../controllers/admin/AdminOrdersController.php Here you should find next string (line 505 in my case): if ($order_carrier->sendInTransitEmail($order)) as you see - there is new function sendInTransitEmail which btw is in the file .../classes/order/OrderCarrier.php This function return True if mai (templates in_transit.html and/ or in_transit.txt) was sent successfully. To disable automatic sending of e-mail we should simply replace above mentioned line to described below: // if ($order_carrier->sendInTransitEmail($order)) if (True) By commenting here the call of this function and set always True in the If clause - we simply bypass sending of this duplicated e-mail as using of shipped template is much more adequate and client-friendly. To finalize - it would be good idea for PS team or somebody who is designing modules to create simple module, where admin would be able to switch off/ on all these a la default PS e-mails (I counted at least 5 of them, which are generating automatically and they sometimes are very irritating). 4 Link to comment Share on other sites More sharing options...
Raiderpoer Posted April 12, 2018 Share Posted April 12, 2018 (edited) On 31/12/2017 at 1:42 AM, Vito said: It is a bit different for PS 1.7.2+ versions. As mentioned above you should change the file .../controllers/admin/AdminOrdersController.php Here you should find next string (line 505 in my case): if ($order_carrier->sendInTransitEmail($order)) as you see - there is new function sendInTransitEmail which btw is in the file .../classes/order/OrderCarrier.php This function return True if mai (templates in_transit.html and/ or in_transit.txt) was sent successfully. To disable automatic sending of e-mail we should simply replace above mentioned line to described below: // if ($order_carrier->sendInTransitEmail($order)) if (True) By commenting here the call of this function and set always True in the If clause - we simply bypass sending of this duplicated e-mail as using of shipped template is much more adequate and client-friendly. To finalize - it would be good idea for PS team or somebody who is designing modules to create simple module, where admin would be able to switch off/ on all these a la default PS e-mails (I counted at least 5 of them, which are generating automatically and they sometimes are very irritating). Hello! When I do what you say, the "Orders" page throws me a 505. EDIT: Now it's working so thx u so much Thank you Best regards Edited April 12, 2018 by Raiderpoer (see edit history) Link to comment Share on other sites More sharing options...
Vito Posted April 23, 2018 Share Posted April 23, 2018 Yes, you just have to deactivate above mentioned condition rule (by commenting "//") , and put instead of it new statement "If (true)" which means it will perform always - no magic. It has to work best regards, Vito Link to comment Share on other sites More sharing options...
roman.b Posted January 15, 2019 Share Posted January 15, 2019 (edited) Hello, Unfortunately, this does not work from 1.6.1.20: /* if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { */ 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[] = Tools::displayError('An error occurred while sending an email to the customer.'); */ It's blank page in orders:Parse error: syntax error, unexpected 'else' (T_ELSE) in controllers/admin/AdminOrdersController.php on line 505 Problem solved: /* if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang),$templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) */ { 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[] = Tools::displayError('An error occurred while sending an email to the customer.'); */ This is correct code, attention to the brackets! Edited January 15, 2019 by roman.b (see edit history) Link to comment Share on other sites More sharing options...
superv Posted April 11, 2019 Share Posted April 11, 2019 I tried in prestashop 1.6.1.23, but it doesn't work it gives me error 500 can someone help me? thank you Link to comment Share on other sites More sharing options...
marekz Posted November 7, 2019 Share Posted November 7, 2019 Hi everyone. Most of mail messages we can disable by admin panel. So, just go to preferences->orders, and exactly there are statuses tab. I'm sorry for image with polish language, but I hope, i helped in spite it. Link to comment Share on other sites More sharing options...
matejmili Posted April 18, 2020 Share Posted April 18, 2020 Am 12.4.2018 um 6:20 PM schrieb Raiderpoer: Hello! When I do what you say, the "Orders" page throws me a 505. EDIT: Now it's working so thx u so much Thank you Best regards Hi, on Prestashop doesn't work this way, I'm getting an error .. Can someone help me? Link to comment Share on other sites More sharing options...
matejmili Posted April 19, 2020 Share Posted April 19, 2020 Hi, on Prestashop doesn't work this way, I'm getting an error .. Can someone help me? Link to comment Share on other sites More sharing options...
M.N Posted February 28, 2021 Share Posted February 28, 2021 Somehow on PS 1.7.7.2 did not work On 12/31/2017 at 2:42 AM, Vito said: It is a bit different for PS 1.7.2+ versions. As mentioned above you should change the file .../controllers/admin/AdminOrdersController.php Here you should find next string (line 505 in my case): if ($order_carrier->sendInTransitEmail($order)) as you see - there is new function sendInTransitEmail which btw is in the file .../classes/order/OrderCarrier.php This function return True if mai (templates in_transit.html and/ or in_transit.txt) was sent successfully. To disable automatic sending of e-mail we should simply replace above mentioned line to described below: // if ($order_carrier->sendInTransitEmail($order)) if (True) By commenting here the call of this function and set always True in the If clause - we simply bypass sending of this duplicated e-mail as using of shipped template is much more adequate and client-friendly. To finalize - it would be good idea for PS team or somebody who is designing modules to create simple module, where admin would be able to switch off/ on all these a la default PS e-mails (I counted at least 5 of them, which are generating automatically and they sometimes are very irritating). So instead I configured different process: 1. I added to copy of /override/classes/order/OrderCarrier.php , line 138 '{delivery_time}' => $carrier->delay, So I can use all the same variables as I have defined for my shipping template. 2. I copied all shipping.html and .txt template content to in_transit.html and .txt in all languages 3. I disabled e-mail sending for delivered status in Shop Parameters, Order Settings 4. I Changed e-mail subject translations in all languages so that In transit and Shipped are the same: Shipped Now I can just send shipping conformation by adding tracking number. After that I set the order as Delivered, where I disabled the e-mail sending. If I still need to send e-mail I can always set status to shipped. Just in case to avoid customer confusion about status you may also rename Delivered as shipped_1 or something... So, it is resolution, not on code, but on process. Link to comment Share on other sites More sharing options...
***didi*** Posted April 15, 2021 Share Posted April 15, 2021 Am 31.12.2017 um 1:42 AM schrieb Vito: It is a bit different for PS 1.7.2+ versions. As mentioned above you should change the file .../controllers/admin/AdminOrdersController.php Here you should find next string (line 505 in my case): if ($order_carrier->sendInTransitEmail($order)) as you see - there is new function sendInTransitEmail which btw is in the file .../classes/order/OrderCarrier.php This function return True if mai (templates in_transit.html and/ or in_transit.txt) was sent successfully. To disable automatic sending of e-mail we should simply replace above mentioned line to described below: // if ($order_carrier->sendInTransitEmail($order)) if (True) By commenting here the call of this function and set always True in the If clause - we simply bypass sending of this duplicated e-mail as using of shipped template is much more adequate and client-friendly. To finalize - it would be good idea for PS team or somebody who is designing modules to create simple module, where admin would be able to switch off/ on all these a la default PS e-mails (I counted at least 5 of them, which are generating automatically and they sometimes are very irritating). Does not work with PS 1.7.7.3 anymore 😭! Has somebody found a simple solution to disable that stupid in_transit mail? Link to comment Share on other sites More sharing options...
Nickovitshj Posted April 19, 2021 Share Posted April 19, 2021 Just stumbled on this issue myself today. Let us know if you found anything. Link to comment Share on other sites More sharing options...
Nickovitshj Posted April 19, 2021 Share Posted April 19, 2021 For PS 1.7.6.5 I edited the following: //if ($order_carrier->sendInTransitEmail($order)) { if(true) { Seems to have worked for me. 1 Link to comment Share on other sites More sharing options...
Sexto Placer Posted May 19, 2021 Share Posted May 19, 2021 Hello, you managed to find the solution. I have version 1.7.7.3 and the above solutions are not working. Thanks Link to comment Share on other sites More sharing options...
Nickz Posted May 19, 2021 Share Posted May 19, 2021 1 hour ago, Sexto Placer said: I have version 1.7.7.3 and the above solutions are not working. downgrade to PS 1.7.6.5 or look for another solution, that's your option. I wouldn't downgrade. Link to comment Share on other sites More sharing options...
Nickovitshj Posted May 20, 2021 Share Posted May 20, 2021 13 hours ago, Sexto Placer said: Hello, you managed to find the solution. I have version 1.7.7.3 and the above solutions are not working. Thanks Seeing as you are the second person on that PS version where it doesn't work It seems there has been changes to the core files. Link to comment Share on other sites More sharing options...
matik4 Posted June 7, 2021 Share Posted June 7, 2021 On 5/19/2021 at 7:38 PM, Sexto Placer said: Hello, you managed to find the solution. I have version 1.7.7.3 and the above solutions are not working. Thanks Hi guys, For Prestashop 1.7.7.0-1.7.7.4 you need to modify a different file since the order page was migrated to Symfony: [please note that you will lose this modification if you upgrade Prestashop in future] File path: /src/Adapter/Order/CommandHandler/UpdateOrderShippingDetailsHandler.php You need to comment out the following part - in my case line 111 to 124: Before: //send mail only if tracking number is different AND not empty if (!empty($trackingNumber) && $oldTrackingNumber != $trackingNumber) { if (!$orderCarrier->sendInTransitEmail($order)) { throw new TransistEmailSendingException('An error occurred while sending an email to the customer.'); } $customer = new Customer((int) $order->id_customer); $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); Hook::exec('actionAdminOrdersTrackingNumberUpdate', [ 'order' => $order, 'customer' => $customer, 'carrier' => $carrier, ], null, false, true, false, $order->id_shop); } After: //send mail only if tracking number is different AND not empty // if (!empty($trackingNumber) && $oldTrackingNumber != $trackingNumber) { // if (!$orderCarrier->sendInTransitEmail($order)) { // throw new TransistEmailSendingException('An error occurred while sending an email to the customer.'); // } // $customer = new Customer((int) $order->id_customer); // $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); // Hook::exec('actionAdminOrdersTrackingNumberUpdate', [ // 'order' => $order, // 'customer' => $customer, // 'carrier' => $carrier, // ], null, false, true, false, $order->id_shop); // } 2 1 Link to comment Share on other sites More sharing options...
Sexto Placer Posted June 8, 2021 Share Posted June 8, 2021 On 6/7/2021 at 4:44 PM, matik4 said: Hi guys, For Prestashop 1.7.7.0-1.7.7.4 you need to modify a different file since the order page was migrated to Symfony: [please note that you will lose this modification if you upgrade Prestashop in future] File path: /src/Adapter/Order/CommandHandler/UpdateOrderShippingDetailsHandler.php You need to comment out the following part - in my case line 111 to 124: Before: //send mail only if tracking number is different AND not empty if (!empty($trackingNumber) && $oldTrackingNumber != $trackingNumber) { if (!$orderCarrier->sendInTransitEmail($order)) { throw new TransistEmailSendingException('An error occurred while sending an email to the customer.'); } $customer = new Customer((int) $order->id_customer); $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); Hook::exec('actionAdminOrdersTrackingNumberUpdate', [ 'order' => $order, 'customer' => $customer, 'carrier' => $carrier, ], null, false, true, false, $order->id_shop); } After: //send mail only if tracking number is different AND not empty // if (!empty($trackingNumber) && $oldTrackingNumber != $trackingNumber) { // if (!$orderCarrier->sendInTransitEmail($order)) { // throw new TransistEmailSendingException('An error occurred while sending an email to the customer.'); // } // $customer = new Customer((int) $order->id_customer); // $carrier = new Carrier((int) $order->id_carrier, $order->id_lang); // Hook::exec('actionAdminOrdersTrackingNumberUpdate', [ // 'order' => $order, // 'customer' => $customer, // 'carrier' => $carrier, // ], null, false, true, false, $order->id_shop); // } Many thanks. All right. All the best! Link to comment Share on other sites More sharing options...
tomasz_be Posted July 15, 2021 Share Posted July 15, 2021 Hi all, If you don't want to send this e-mail each time you add/update a tracking number for a specific order, you can override sendInTransitEmail() function by creating the following file in /override/classes/order/OrderCarrier.php <?php /** * OrderCarrier override : disable in_transit emails * */ defined('_PS_VERSION_') or die; class OrderCarrier extends OrderCarrierCore { /** * @param Order $order Required * * @return bool */ public function sendInTransitEmail($order) { return true; } } This function is only called from /src/Adapter/Order/CommandHandler/UpdateOrderShippingDetailsHandler.php If you clear your Prestashop cache, then it won't send at all the in_transit email when you add/update tracking number. It works in Prestashop 1.7.7.2 and as it is an override, you won't loose your modification when you update Prestashop. Hope it helps. 5 1 Link to comment Share on other sites More sharing options...
jetx Posted October 12, 2021 Share Posted October 12, 2021 On 7/15/2021 at 11:38 PM, tomasz_be said: Hi all, If you don't want to send this e-mail each time you add/update a tracking number for a specific order, you can override sendInTransitEmail() function by creating the following file in /override/classes/order/OrderCarrier.php <?php /** * OrderCarrier override : disable in_transit emails * */ defined('_PS_VERSION_') or die; class OrderCarrier extends OrderCarrierCore { /** * @param Order $order Required * * @return bool */ public function sendInTransitEmail($order) { return true; } } This function is only called from /src/Adapter/Order/CommandHandler/UpdateOrderShippingDetailsHandler.php If you clear your Prestashop cache, then it won't send at all the in_transit email when you add/update tracking number. It works in Prestashop 1.7.7.2 and as it is an override, you won't loose your modification when you update Prestashop. Hope it helps. Great, thanks for this. Link to comment Share on other sites More sharing options...
emma123 Posted November 22, 2021 Share Posted November 22, 2021 fantastic tomasz_be with 1.7.7.2 all fine Link to comment Share on other sites More sharing options...
nedarbs Posted February 1, 2022 Share Posted February 1, 2022 On 4/19/2021 at 12:13 PM, Nickovitshj said: For PS 1.7.6.5 I edited the following: //if ($order_carrier->sendInTransitEmail($order)) { if(true) { Seems to have worked for me. Thank you, this worked for me (on same version)! 1 Link to comment Share on other sites More sharing options...
Jonas Ocampo Posted March 25, 2022 Share Posted March 25, 2022 (edited) Thank you, this worked for me in Prestashop 1.7.8.5 Edited May 12, 2022 by Jonas Ocampo (see edit history) Link to comment Share on other sites More sharing options...
Jonas Ocampo Posted May 12, 2022 Share Posted May 12, 2022 On 10/11/2021 at 10:06 PM, jetx said: Great, thanks for this. Thank you, this worked for me in Prestashop 1.7.8.5 Link to comment Share on other sites More sharing options...
Manu-41 Posted December 3, 2022 Share Posted December 3, 2022 +1 Merci Ok sur 1.7.8.2 <?php /** * OrderCarrier override : disable in_transit emails * */ defined('_PS_VERSION_') or die; class OrderCarrier extends OrderCarrierCore { /** * @param Order $order Required * * @return bool */ public function sendInTransitEmail($order) { return true; } } Link to comment Share on other sites More sharing options...
Daresh Posted November 24, 2023 Share Posted November 24, 2023 If you're not comfortable modifying the source code, check out the Email Toolbox module. You can simply enter email template names there that you want the shop to stop sending. 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