Jump to content

Disable mail for CREDIT SLIP.


Recommended Posts

  • 1 year later...

A bit late, but if others are searching, here's the solution.
In controllers/admin/ find the file AdminOrdersController.php
 
On line 956 (depending on version - else search for 'credit_slip') remove this piece of code:

@Mail::Send(
	(int)$order->id_lang,
	'credit_slip',
	Mail::l('New credit slip regarding your order', (int)$order->id_lang),
	$params,
	$customer->email,
	$customer->firstname.' '.$customer->lastname,
	null,
        null,
	null,
        null,
	_PS_MAIL_DIR_,
	true,
	(int)$order->id_shop
);
Edited by Christiaan_01 (see edit history)
Link to comment
Share on other sites

  • 1 month later...

 

A bit late, but if others are searching, here's the solution.

In controllers/admin/ find the file AdminOrdersController.php

 

On line 956 (depending on version - else search for 'credit_slip') remove this piece of code:

@Mail::Send(
	(int)$order->id_lang,
	'credit_slip',
	Mail::l('New credit slip regarding your order', (int)$order->id_lang),
	$params,
	$customer->email,
	$customer->firstname.' '.$customer->lastname,
	null,
        null,
	null,
        null,
	_PS_MAIL_DIR_,
	true,
	(int)$order->id_shop
);

 

Thanks! Exactly what I was looking for.

Link to comment
Share on other sites

  • 8 months later...

Thanks, also what I was looking for. To adjust it the 'clean' way you can override the Mail class:

class Mail extends MailCore
{
     public static function Send($id_lang, $template, $subject, $template_vars, $to,
        $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
        $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null)
    {
         // Don't send an email a credit slip is created (not configurable in backoffice)
         if ($template == 'credit_slip') {
             return true;
         }
         
         return parent::Send($id_lang, $template, $subject, $template_vars, $to, $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop, $bcc, $reply_to);
     }
}
  • Like 1
Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
  • 2 weeks later...
On 5/16/2019 at 10:24 PM, MageryThemes said:

Overriding of MailCore class is not the best option.

It's better to use hooks. You can use standard actionEmailSendBefore hook to disable email notification.

If you are interested, we have a paid module for disabling emails.

on 1.6.x version i think that actionEmailSendBefore  is not implemented yet is why mail override is necessary

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

For PS 1.7.7.8 the new file is located in

/src/Adapter/Order/Refund/OrderSlipCreator.php

Comment out this piece:

@Mail::Send(
                (int) $orderLanguage->getId(),
                'credit_slip',
                $this->translator->trans(
                    'New credit slip regarding your order',
                    [],
                    'Emails.Subject',
                    $orderLanguage->locale
                ),
                $params,
                $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

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