Jump to content

Overraid class Mail.php how to?


ANGELO Vintage

Recommended Posts

Hi, this is my first attempt to working on overraid a class, in my case is the mail.php.

I need to add a specific BCC mail address in case the send function still sending the "shipped" template so i made this short code:

<?php

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)
{
    // add trustpilot SFA 2.0
    if($template == 'shipped')
    {
        $bcc = '[email protected]';
    }      
    
    // send to customer
    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);
}
?>

I place the Mail.php containing the code above in /override/classes folder, deleted the /cache/class_index.php file too.

I've not find why it not working, giving me back error 500.

 

I use prestashop 1.6.1.13

 

Thank you for any help

Link to comment
Share on other sites

Hi, this is my first attempt to working on overraid a class, in my case is the mail.php.

I need to add a specific BCC mail address in case the send function still sending the "shipped" template so i made this short code:

<?php

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)
{
    // add trustpilot SFA 2.0
    if($template == 'shipped')
    {
        $bcc = '[email protected]';
    }      
    
    // send to customer
    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);
}
?>

I place the Mail.php containing the code above in /override/classes folder, deleted the /cache/class_index.php file too.

I've not find why it not working, giving me back error 500.

 

I use prestashop 1.6.1.13

 

Thank you for any help

 

Enable errors https://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information-blank-page-500-internal-server-error/

Link to comment
Share on other sites

PS v1.6.1.13 expects bcc to be an array

        // if bcc is not null, make sure it's a vaild e-mail
        if (!is_null($bcc) && !is_array($bcc) && !Validate::isEmail($bcc)) {
            Tools::dieOrLog(Tools::displayError('Error: parameter "bcc" is corrupted'), $die);
            $bcc = null;
        }

use this instead

if($template == 'shipped')
{
      $bcc = array('[email protected]');
}

 

 

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