Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Minik

Disable in_transit email

Recommended Posts

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);

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 )) {

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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);

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

@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.

  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...