
By default in Prestashop 1.7.x and 1.6.x, languages switcher module does not display flags icons.
Solution for Prestashop 1.7.x
Language selector block modification
There’s a simple solution if you want to display a flag next to each language you are using form your eshop made with Prestashop.
Please, follow these steps:
- Use your favourite Text Editor like Notepad++ and open ps_languageselector.tpl located inside
/your-online-installation/themes/your-theme/modules/ps_languageselector/
Note: if the folder called ps_languageselector does not exist in your theme directory, create this folder inside
/your-online-installation/themes/your-theme/modules/
and paste the file called ps_languageselector.tpl you copied from
/your-online-installation/modules/ps_languageselector/ - Use your favourite Text editor and open ps_languageselector.tpl
- About row 30, add
<img alt="{$current_language.name_simple}" src="{$urls.base_url}/img/l/{$language.id}.jpg" width="16" height="11">
before<i class="material-icons expand-more">
- Change twice (about rows 36 and 42)
{$language.name_simple}
- with
<img alt="{$current_language.name_simple}" src="{$urls.base_url}img/l/{$language.id_lang}.jpg" width="16" height="11"> {$language.name_simple}
- Save and overwrite
- It could be necessary to delete the cache of Prestashop (Advanced Parameters > Performance) and of your browser. (Please, be sure that Recompile templates if the files have been updated is enabled)
Solution for Prestashop 1.6.x
Block languages module modification
There’s a simple solution if you want to display a flag next to each language you are using form your eshop made with Prestashop.
Please, follow these steps:
- Use your favourite Text Editor like Notepad++ and open blocklanguages.tpl located inside
/your-online-installation/themes/your-theme/modules/blocklanguages/
Note: if the folder called blocklanguages does not exist in your theme directory, create this folder inside
/your-online-installation/themes/your-theme/modules/
and paste the file called blocklanguages.tpl you copied from
/your-online-installation/modules/blocklanguages/ - Use your favourite Text editor and open blocklanguages.tpl
- Change twice (about rows 31 and 46)
{$language.name|regex_replace:"/s.*$/":""}
- with
<img alt="{$language.iso_code}" height="11" alt="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" /> {$language.name|regex_replace:"/s(.*)$/":""}
- Save and overwrite
- It could be necessary to delete the cache of Prestashop (Advanced Parameters > Performances) and of your browser. (Please, be sure that Recompile templates if the files have been updated is enabled)
Last steps
Note: do not forget to install your languages and upload flag icons using your Administration Panel > Localization > Languages.
If everything has gone well, you will find your images inside your-online-installation/img/l/
Otherwise you can get flag icons here: www.famfamfam.com/lab/icons/flags/
We are curious to read your opinion!