Jump to content
thirty bees forum

Recommended Posts

Posted

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

Posted

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

Posted

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!

Posted

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

  • 6 months later...
Posted

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.

Posted

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.

Posted

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

  • 1 year later...
Posted
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.

Posted

@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
  • 1 year later...
Posted

 

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

Posted
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:

image.png.a46d1bc62796a9c3f560ad0dd7f47aba.png

 

Posted (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:

image.png.a46d1bc62796a9c3f560ad0dd7f47aba.png

 

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 by Leaton
Posted

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

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