Jump to content

(SOLVED) Change the editorial module logo image according to the selected language


Recommended Posts

Hi all,
I need to change the the editorial module logo image for my store depending on the language selected by the user.
The module's page don't admit a diferent image for earh language but anybody knows how to manage for doing it?

Thanks!

Link to comment
Share on other sites

I thing one way is to insert a language variable

{$lang_iso}

into the following code(modules/editorial/editorial.tpl):

<!-- Module Editorial -->

   {if $editorial->body_home_logo_link}body_home_logo_link|escape:'htmlall':'UTF-8'}" title="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}">{/if}
   {if $homepage_logo}getMediaLink($image_path)}" alt="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}" {if $image_width}width="{$image_width}"{/if} {if $image_height}height="{$image_height}" {/if}/>{/if}
   {if $editorial->body_home_logo_link}{/if}
   {if $editorial->body_logo_subheading}
{$editorial->body_logo_subheading|stripslashes}
   {elseif $editorial->body_logo_subheading}
{$editorial->body_logo_subheading}{/if} 
   {if $editorial->body_title}{$editorial->body_title|stripslashes}
   {elseif $editorial->body_title}{$editorial->body_title|stripslashes}{/if}
   {if $editorial->body_subheading}{$editorial->body_subheading|stripslashes}
   {elseif $editorial->body_subheading}{$editorial->body_subheading|stripslashes}{/if}
   {if $editorial->body_paragraph}{$editorial->body_paragraph|stripslashes}
   {elseif $editorial->body_paragraph}{$editorial->body_paragraph|stripslashes}{/if}

<!-- /Module Editorial -->



But I don't know how to... Anybody knows how to do it? Thanks!

Link to comment
Share on other sites

good idea, nest.
Here is how to implement your idea

1. add following code in file /modules/editorial/editorial.php (PHP)

look for function hookHome(), inside of this function

after line

               global $cookie, $smarty;



adding following lines

               $language = new Language($cookie->id_lang);
               $smarty->assign('lang',$language->iso_code);



2. change file /modules/editorial/editorial.tpl (TPL)

look for this code

src="{$this_path}homepage_logo.jpg"



change to

src="{$this_path}homepage_logo_{$lang}.jpg"




3. create image for all language and upload to folder /modules/editorial/
homepage_logo_en.jpg
homepage_logo_fr.jpg
homepage_logo_es.jpg

I have not test it yet, but it should work

Link to comment
Share on other sites

Hi shokinro,

thanks for the answer, it seems a great idea. Only one problem:

You say to change in /modules/editorial/editorial.tpl (TPL) the code

src="{$this_path}homepage_logo.jpg"



but this expresion don't exists in the /modules/editorial/editorial.tpl, the only code involved in the generation of this link is the following conditional:

{if $editorial->body_home_logo_link}body_home_logo_link|escape:'htmlall':'UTF-8'}" title="{$editorial->body_title|escape:'htmlall':'UTF-8'|stripslashes}">{/if}



There are not any

src=""



in the whole code of editorial.tpl file.

Any idea for doing it? Thanks again, my hope grow up with your answer!

Link to comment
Share on other sites

1. add following code in file /modules/editorial/editorial.php (PHP)

look for function hookHome(), inside of this function

after line

               global $cookie, $smarty;



adding following lines

               $language = new Language($cookie->id_lang);




2. In the same file, change following line

from

           'image_path' => $this->_path.'homepage_logo.jpg'



To

           'image_path' => $this->_path.'homepage_logo_' . $language->iso_code . '.jpg'




3. create image for all language and upload to folder /modules/editorial/
homepage_logo_en.jpg
homepage_logo_fr.jpg
homepage_logo_es.jpg


Hope this works for you

Link to comment
Share on other sites

Now working fine shokinro!!
At first time I did all steps but didn't works, the image was not loaded. But then I saw that the line just before

'image_path' => $this->_path.'homepage_logo_' . $language->iso_code . '.jpg'



was

'homepage_logo' => file_exists('modules/editorial/homepage_logo.jpg'),



and I just only changed it for

'homepage_logo' => file_exists('modules/editorial/homepage_logo_' . $language->iso_code . '.jpg'),



as you did with the 'image_path' link and now works fine!


Thanks!!!! I was unable to solve it for myselve, great info for me! I edited the title as (SOLVED) for future reference for who need.

Link to comment
Share on other sites

×
×
  • Create New...