Prestashop 1.7.7.0
Hi to all.
I need to programmatically change the logo in email templates.
How to work with parameters in the hook?
My custom image my-custom-logo.jpg not changed in mail templates.
This params not work:
$params['templateVars']['{shop_logo}'] = $logo;
Full code:
public function hookActionEmailSendBefore($params) { $id_lang = $params['idLang']; $templateVars = $params['templateVars']; $id_order = $templateVars['{id_order}']; $id_shop = $params['idShop']; $get_custom_logo = _PS_IMG_DIR_.'my-custom-logo.jpg'; if (file_exists($get_custom_logo)){ $logo = $get_custom_logo; } else { if (false !== Configuration::get('PS_LOGO_MAIL') && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MAIL', null, null, $id_shop))) { $logo = _PS_IMG_DIR_ . Configuration::get('PS_LOGO_MAIL', null, null, $id_shop); } else { if (file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO', null, null, $id_shop))) { $logo = _PS_IMG_DIR_ . Configuration::get('PS_LOGO', null, null, $id_shop); } else { $templateVars['{shop_logo}'] = ''; } } } $params['templateVars']['{shop_logo}'] = $logo; return; }
Thank you
.png.022b5452a8f28f552bc9430097a16da2.png)