Minik Posted January 24, 2018 Share Posted January 24, 2018 How do i disable the in_transit email so the customer do not receive the email everytime i insert a trackingnumber for an order? The problem was solved by following @wakabayashi 's suggestion by editing AdminOrdersController.php in /public_html/controllers/admin/. Change: 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', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$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.'); } To Hook::exec('actionAdminOrdersTrackingNumberUpdate', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); Link to comment Share on other sites More sharing options...
wakabayashi Posted January 24, 2018 Share Posted January 24, 2018 You need to modify the if (@Mail::Send) a bit. if you want to get clean code answer, you shouldn't add the code by screenshot... Link to comment Share on other sites More sharing options...
wakabayashi Posted January 24, 2018 Share Posted January 24, 2018 Maybe this topic is intresting for you too: https://forum.thirtybees.com/topic/1381/brainstorming-handling-orders-in-bo/20 I am talking a bit about emails too. Link to comment Share on other sites More sharing options...
Minik Posted January 24, 2018 Author Share Posted January 24, 2018 Hello @wakabayashi What exactly would you suggest with the "if (1==1) {}" ? The code looks 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 )) { Link to comment Share on other sites More sharing options...
wakabayashi Posted January 24, 2018 Share Posted January 24, 2018 Sorry forget my answer before... Change 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', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$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.'); } To: Hook::exec('actionAdminOrdersTrackingNumberUpdate', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); I have tried this solution. So please test it out! Link to comment Share on other sites More sharing options...
Minik Posted January 24, 2018 Author Share Posted January 24, 2018 I get a 500 server error with that code when i go to Backoffice - Orders Link to comment Share on other sites More sharing options...
wakabayashi Posted January 24, 2018 Share Posted January 24, 2018 Can you please show me the error or your code. I cant solve it otherwise. Link to comment Share on other sites More sharing options...
Minik Posted January 24, 2018 Author Share Posted January 24, 2018 It works now, thank you very much. I changed: 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', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$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.'); } To Hook::exec('actionAdminOrdersTrackingNumberUpdate', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); Link to comment Share on other sites More sharing options...
wakabayashi Posted January 24, 2018 Share Posted January 24, 2018 Ok nice! have you checked, if no email is going out? Link to comment Share on other sites More sharing options...
Minik Posted January 24, 2018 Author Share Posted January 24, 2018 Yes, it works perfect with no errors and no in_transit email. Link to comment Share on other sites More sharing options...
wakabayashi Posted January 24, 2018 Share Posted January 24, 2018 Cool! Link to comment Share on other sites More sharing options...
wakabayashi Posted January 25, 2018 Share Posted January 25, 2018 I move this topic no to the tipps section ;) Link to comment Share on other sites More sharing options...
DRMasterChief Posted August 21, 2018 Share Posted August 21, 2018 Hi, can anyone please tell me if this is solved in tb 1.0.5 ?? thank you Link to comment Share on other sites More sharing options...
lesley Posted August 21, 2018 Share Posted August 21, 2018 Its not a bug is it? Link to comment Share on other sites More sharing options...
DRMasterChief Posted August 21, 2018 Share Posted August 21, 2018 sorry, this should be here: https://forum.thirtybees.com/topic/1542/recaptcha-module-confirmation-unknown-message/26 (i opened both tabs in Chrome and sent it at the wrong, sorry) Link to comment Share on other sites More sharing options...
doclucas Posted August 28, 2018 Share Posted August 28, 2018 I think it is very important to note in such threads that modifying core code directly is not recommended and won't survive future TB/core updates (manual copying of modifications is required when upgrading). It's always best to use overrides when possible. Link to comment Share on other sites More sharing options...
Traumflug Posted August 28, 2018 Share Posted August 28, 2018 It’s always best to use overrides when possible. Best is to get bug fixes into core. Which requires a fairly clear description of what the actual problem is, together with the changed files in an issue report. Link to comment Share on other sites More sharing options...
doclucas Posted August 28, 2018 Share Posted August 28, 2018 @traumflug said in Disable in_transit email: It’s always best to use overrides when possible. Best is to get bug fixes into core. Which requires a fairly clear description of what the actual problem is, together with the changed files in an issue report. Of course, but this is not a bug as far as I understand, and as lesley pointed out above. Link to comment Share on other sites More sharing options...
Leaton Posted July 6, 2020 Share Posted July 6, 2020 On 8/28/2018 at 11:50 AM, Traumflug said: It’s always best to use overrides when possible. Best is to get bug fixes into core. Which requires a fairly clear description of what the actual problem is, together with the changed files in an issue report. Sorry for reviving this old thread, just wanted to add my 2 cents. In my opinion this is a bug as the in_transit status and e-mail are hard coded instead of being an actual order status (that could then easily be disabled) with attached e-mail. So what happens is at the moment you add a tracking number it sends the in_transit e-mail to your customers, when you change the shipping status to ´sent´ it then sends the shipped status e-mail. This means customers get 2 e-mails in a row where the in_transit e-mail is then useless. Link to comment Share on other sites More sharing options...
wakabayashi Posted July 6, 2020 Share Posted July 6, 2020 @Leaton thats correct. I have changed this behaviour in our shop. It will only send one email and if there is a tracking code it will add it to the email... Depending on the new TB team, I will maybe add a PR, to make this the default behaviour. 1 Link to comment Share on other sites More sharing options...
AndyC Posted November 2, 2021 Share Posted November 2, 2021 Also waiting for a solution.. Want to disable sending a email when entering a number Link to comment Share on other sites More sharing options...
Leaton Posted November 2, 2021 Share Posted November 2, 2021 14 minutes ago, AndyC said: Also waiting for a solution.. Want to disable sending a email when entering a number Hi Andy, the solution is to edit the files as noted by wakabayashi - it seems it was still not recognized as being a bug after all this time but take in account that with any update you might lose the edit so it's best to do it as an override as noted by doclucas On 1/24/2018 at 4:13 PM, Minik said: How do i disable the in_transit email so the customer do not receive the email everytime i insert a trackingnumber for an order? The problem was solved by following @wakabayashi 's suggestion by editing AdminOrdersController.php in /public_html/controllers/admin/. Change: 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', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$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.'); } To Hook::exec('actionAdminOrdersTrackingNumberUpdate', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier], null, false, true, false, $order->id_shop); Tools::redirectAdmin(static::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); Link to comment Share on other sites More sharing options...
datakick Posted November 2, 2021 Share Posted November 2, 2021 15 minutes ago, Leaton said: Hi Andy, the solution is to edit the files as noted by wakabayashi - it seems it was still not recognized as being a bug after all this time but take in account that with any update you might lose the edit so it's best to do it as an override as noted by doclucas Yes, it's not recognised as a bug. This is expected and wanted behaviour. Some merchants would be angry if we removed this functionality, actually. As was suggested above -- you can modify the core file, or create an override. But you can also install my consequences module, and create rule that will block sending this particular email from your store: Link to comment Share on other sites More sharing options...
Leaton Posted November 2, 2021 Share Posted November 2, 2021 (edited) 7 minutes ago, datakick said: Yes, it's not recognised as a bug. This is expected and wanted behaviour. Some merchants would be angry if we removed this functionality, actually. As was suggested above -- you can modify the core file, or create an override. But you can also install my consequences module, and create rule that will block sending this particular email from your store: The reason I see it as being a bug is that it should be a shipping status that can be easily dissabled or editted without editting core files or using extra modules. I think that would make a lot more sense. Edited November 2, 2021 by Leaton Link to comment Share on other sites More sharing options...
the.rampage.rado Posted November 2, 2021 Share Posted November 2, 2021 I would like to have the in transit email sent out when I set the tracking number in BO. But I would like to have Sent out option and the in transit status somehow merged. Now I have to manually change the status to Sent out (which sends out an email by default). Then I have to put in tracking number (this sends almost the same email, same title, etc with the only one line added - the tracking URL. I would like to have this in single action, I doubt it could be done so I have disabled the Sent out email and the customer receive only 1 email with tracking number which states that the order is shipped. 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