Jump to content

[SOLVED] Logo translation : How to translate logo pic img


Recommended Posts

You need to make small change in header.tpl in your theme folder
Add _{$lang_iso} in image source name.So change this code

<h1 id="logo"><a href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}"><img src="{$img_ps_dir}logo.jpg" alt="{$shop_name|escape:'htmlall':'UTF-8'}" />


to

<h1 id="logo"><a href="{$base_dir}" title="{$shop_name|escape:'htmlall':'UTF-8'}"><img src="{$img_ps_dir}logo_{$lang_iso}.jpg" alt="{$shop_name|escape:'htmlall':'UTF-8'}" />


and then in your root / img folder reneme logo.jpg to logo_en.jpg for English, logo_fr.jpg for French and similar to other languages you have.

Link to comment
Share on other sites

Yes, Thank you very much, I will do that

i found the following code in Prestashop/Modules/blocknewsletter/mails/en/newsletter_conf.html

img src="{shop_logo}" alt="{shop_name}" title="{shop_name}" border="0"



Can we replace again "logo" by something such as " logo_{$lang_iso} " ?
We already did it in header.tpl, can we do it again here?

Thank you very much
Have a good day
Respectfully
Link to comment
Share on other sites

I found these post from rocky

It is this code on lines 138 and 139 of classes/PDF.php that adds the logo to the PDFs:

if (file_exists(_PS_IMG_DIR_.'/logo.jpg'))
   $this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15);



If you want to have a different image in the PDF than on the Front Office, you'll need to put a separate image in the img folder in Prestashop's root (not your theme directory) such as logo-pdf.jpg and change the filename in the code above from logo.jpg to logo-pdf.jpg.



No, it is only for the PDF invoices. For emails, you'll need to modify line 94 of classes/Mail.php:

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



Change logo.jpg to something like logo-email.jpg and put an image with that name in the img directory in the root of Prestashop.



And I changed code in PDF.php to (first line with iso variable is new)
        $iso = Language::getIsoById($cookie->id_lang);
       if (file_exists(_PS_IMG_DIR_.'/logo_'.$iso.'.jpg'))
           $this->Image(_PS_IMG_DIR_.'/logo_'.$iso.'.jpg', 10, 8, 0, 15);



For Mail.php variable $iso exist so you try this

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



I tested for PDF and it works and for Mail i didn't do test but it should work.

Link to comment
Share on other sites

Good morning,

It is fantastic
It works very well for PDF and for Newsletter
Although you have to make sure you have the respective files in
in modules/blocknewsletter/mail/

For example when i first tried for SPANISH it didnt worked
Beause i had not uploaded the spanish newsletter_conf.html

So i uploaded all newsletter_conf.html for each languages of my shop
And now everything works perfectly, Thank you very much for your precious help :)

Thank you very much
Have a very good day
Very respectfully

26193_R4wdR0uGGmHmzeAng72e_t

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