January 24, 20188 yr 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);
January 24, 20188 yr 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...
January 24, 20188 yr 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.
January 24, 20188 yr Author 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 )) {
January 24, 20188 yr 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!
January 24, 20188 yr Author 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);
August 21, 20188 yr 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)
August 28, 20188 yr 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.
August 28, 20188 yr 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.
August 28, 20188 yr @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.
July 6, 20206 yr 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.
July 6, 20206 yr @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.
November 2, 20215 yr Also waiting for a solution.. Want to disable sending a email when entering a number
November 2, 20215 yr 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);
November 2, 20215 yr 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:
November 2, 20215 yr 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, 20215 yr by Leaton
November 2, 20215 yr 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.
Create an account or sign in to comment