Menu
Supprimer le logo en pièce jointe
Accueil > Supprimer le logo en pièce jointe
Supprimer le logo en pièce jointe
Référence : Astuce
Info

Pour ma part j'ai modifié le fichier mail.php pour ne plus avoir le logo en pièce jointe lorsqu'on a supprimé la variable {shop_logo}, mais qu'il s'affiche quand même dans les mails où cette variable est présente.
Ligne 145 (version 1.4.1) remplacer:
 

   $templateVars['{shop_logo}'] = (file_exists(_PS_IMG_DIR_.'logo_mail.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo_mail.jpg'))) : ((file_exists(_PS_IMG_DIR_.'logo.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo.jpg'))) : '');

par:

   $templateVars['{shop_logo}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'img/logo_mail.jpg' ;


Edit du 04/10/2012
Pour Presta 1.5 (jusqu'à 1.5.1)
remplacer:

Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))) :
	 ((file_exists(_PS_IMG_DIR_.'logo.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO')))) : '');

par:

Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))) :
	 Tools::getShopDomain(true, true).__PS_BASE_URI__.'img/logo_mail.jpg' ;


Pour la 1.5.2 (ben oui autant garder ce bug, même si on met à jour les fichiers...)
commenter cette partie:

else
if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO'))));

Pour la 1.5.4 et suivantes (vraiment têtus les zozos!) remplacez ces lignes (249 - 251)

/* don't attach the logo as */
if (isset($logo))
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo)));

par:

/* don't attach the logo as */
if (isset($logo))
    $template_vars['{shop_logo}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'img/'.Configuration::get('PS_LOGO', null, null, $id_shop);

Eolia 

Pour ma part j'ai modifié le fichier mail.php pour ne plus avoir le logo en pièce jointe lorsqu'on a supprimé la variable {shop_logo}, mais qu'il s'affiche quand même dans les mails où cette variable est présente.
Ligne 145 (version 1.4.1) remplacer:
 

   $templateVars['{shop_logo}'] = (file_exists(_PS_IMG_DIR_.'logo_mail.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo_mail.jpg'))) : ((file_exists(_PS_IMG_DIR_.'logo.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo.jpg'))) : '');

par:

   $templateVars['{shop_logo}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'img/logo_mail.jpg' ;


Edit du 04/10/2012
Pour Presta 1.5 (jusqu'à 1.5.1)
remplacer:

Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))) :
	 ((file_exists(_PS_IMG_DIR_.'logo.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO')))) : '');

par:

Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL')))) :
	 Tools::getShopDomain(true, true).__PS_BASE_URI__.'img/logo_mail.jpg' ;


Pour la 1.5.2 (ben oui autant garder ce bug, même si on met à jour les fichiers...)
commenter cette partie:

else
if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.Configuration::get('PS_LOGO'))));

Pour la 1.5.4 et suivantes (vraiment têtus les zozos!) remplacez ces lignes (249 - 251)

/* don't attach the logo as */
if (isset($logo))
$template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo)));

par:

/* don't attach the logo as */
if (isset($logo))
    $template_vars['{shop_logo}'] = Tools::getShopDomain(true, true).__PS_BASE_URI__.'img/'.Configuration::get('PS_LOGO', null, null, $id_shop);

Eolia 

5 2
5 5
Merci pour cet article, je l'ai testé sur ma 1.6.0.9 avec succès.
5 5
Et bien cela faisait des lustres que je cherchais comment faire!

Merci bcp :)

Écrire un avis


Votre nom :


Votre avis :
Note : Le HTML n’est pas pris en charge


Évaluation :
Mauvais
           Bon