Jump to content

Edit History

ps8modules

ps8modules

Just that editing Mail.php is the right place, or use hooks in your module and add custom variable sending the email.

public function hookActionEmailSendBefore($param)
{
    /* set default or if not exists */    
    $newgraph = _PS_IMG_DIR_.'n/custom-image.jpg';

    /* add image for specific template */
    $mailTemplates = array('order_conf', 'my_custom_template');

    $tpl_name = (string) $param['template'];
    $id_lang = (int) $param['id_lang'];
    
    /* if template in $mailTemplates */
    if (in_array($tpl_name, $mailTemplates, true)) {
        if (file_exists($newgraph)) {
            $message = new Swift_Message();
            $param['template_vars']['{newgraph}'] = $message->embed(\Swift_Image::fromPath($newgraph));
        }
    }
}

 

ps8modules

ps8modules

Just that editing Mail.php is the right place, or use hooks in your module and add custom variable sending the email.

public function hookActionEmailSendBefore($param)
{
    /* set default or if not exists */    
    $newgraph = _PS_IMG_DIR_.'n/custom-logo.jpg';

    /* change logo for specific template */
    $mailTemplates = array('order_conf', 'my_custom_template');

    $tpl_name = (string) $param['template'];
    $id_lang = (int) $param['id_lang'];
    
    /* if template in $mailTemplates */
    if (in_array($tpl_name, $mailTemplates, true)) {
        if (file_exists($newgraph)) {
            $message = new Swift_Message();
            $param['template_vars']['{newgraph}'] = $message->embed(\Swift_Image::fromPath($newgraph));
        }
    }
}

 

×
×
  • Create New...