PrestaMarketing Posted July 7, 2014 Share Posted July 7, 2014 (edited) The default theme of the 1.6 Prestashop version is very comprehensive, but we missed the flags on the language selector, instead of (or plus) language text. We wanted to complete the original blocklanguages selector: into this: We have make little changes to do work flags on our customized default prestashop 1.6 theme, and want to share it with you: Basically, what we did was add these code lines to our "blocklanguages.tpl" file: <img style="border: solid 3px #fff; margin-right:5px;" src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /> Of course, you can modify the width and height of your flags and adapt your CSS as you need. We use 1.6.0.5 version and this is the full code on our "blocklanguages.tpl" file (that should work on all 1.6 versdions). As you can see, we have commented a line at the end of the tpl, to replace {$language.name|regex_replace:"/\s.*$/":""} by the flag image code. Here you are, the full content code in "../themes/default-bootstrap/modules/blocklanguages.tpl": {* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- Block languages module --> {if count($languages) > 1} <div id="languages-block-top" class="languages-block"> {foreach from=$languages key=k item=language name="languages"} {if $language.iso_code == $lang_iso} <div class="current"> <!-- Flag image --> <img style="border: solid 3px #fff; margin-right:5px;" src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /><!-- /Flag image --> <span>{$language.name|regex_replace:"/\s.*$/":""}</span> </div> {/if} {/foreach} <ul id="first-languages" class="languages-block_ul toogle_content"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected"{/if}> {if $language.iso_code != $lang_iso} {assign var=indice_lang value=$language.id_lang} {if isset($lang_rewrite_urls.$indice_lang)} <a href="{$lang_rewrite_urls.$indice_lang|escape:'html':'UTF-8'}" title="{$language.name}"> {else} <a href="{$link->getLanguageLink($language.id_lang)|escape:'html':'UTF-8'}" title="{$language.name}"> {/if} {/if} <span><!-- Flag image --><img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /><!-- /Flag image--><!--{$language.name|regex_replace:"/\s.*$/":""}--></span> {if $language.iso_code != $lang_iso} </a> {/if} </li> {/foreach} </ul> </div> {/if} <!-- /Block languages module --> You can download the tpl too if you prefer to replace it by the original. We recommend you make a backup or, better, rename the original file in case you have to restore it in the future. We hope you find this litte contributtion useful blocklanguages.zip Edited July 7, 2014 by PrestaMarketing (see edit history) 4 1 Link to comment Share on other sites More sharing options...
ldx1202 Posted August 1, 2014 Share Posted August 1, 2014 big thx, it works perfectly ! Link to comment Share on other sites More sharing options...
PrestaMarketing Posted August 1, 2014 Author Share Posted August 1, 2014 big thx, it works perfectly ! Link to comment Share on other sites More sharing options...
sounds Posted August 7, 2014 Share Posted August 7, 2014 (edited) Thanks nice find Edited August 7, 2014 by sounds (see edit history) Link to comment Share on other sites More sharing options...
Mephivio Posted August 11, 2014 Share Posted August 11, 2014 is it possible to display flags only on a single line ? with a grey effect for the language(s) witch are not selected ? Link to comment Share on other sites More sharing options...
vekia Posted August 12, 2014 Share Posted August 12, 2014 for li element style add style="display:inline-block; float:left;" optionally add some padding / or margin param Link to comment Share on other sites More sharing options...
lindertmedia Posted November 30, 2014 Share Posted November 30, 2014 The default theme of the 1.6 Prestashop version is very comprehensive, but we missed the flags on the language selector, instead of (or plus) language text. We wanted to complete the original blocklanguages selector: into this: We have make little changes to do work flags on our customized default prestashop 1.6 theme, and want to share it with you: Basically, what we did was add these code lines to our "blocklanguages.tpl" file: <img style="border: solid 3px #fff; margin-right:5px;" src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /> Of course, you can modify the width and height of your flags and adapt your CSS as you need. We use 1.6.0.5 version and this is the full code on our "blocklanguages.tpl" file (that should work on all 1.6 versdions). As you can see, we have commented a line at the end of the tpl, to replace {$language.name|regex_replace:"/\s.*$/":""} by the flag image code. Here you are, the full content code in "../themes/default-bootstrap/modules/blocklanguages.tpl": {* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- Block languages module --> {if count($languages) > 1} <div id="languages-block-top" class="languages-block"> {foreach from=$languages key=k item=language name="languages"} {if $language.iso_code == $lang_iso} <div class="current"> <!-- Flag image --> <img style="border: solid 3px #fff; margin-right:5px;" src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /><!-- /Flag image --> <span>{$language.name|regex_replace:"/\s.*$/":""}</span> </div> {/if} {/foreach} <ul id="first-languages" class="languages-block_ul toogle_content"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected"{/if}> {if $language.iso_code != $lang_iso} {assign var=indice_lang value=$language.id_lang} {if isset($lang_rewrite_urls.$indice_lang)} <a href="{$lang_rewrite_urls.$indice_lang|escape:'html':'UTF-8'}" title="{$language.name}"> {else} <a href="{$link->getLanguageLink($language.id_lang)|escape:'html':'UTF-8'}" title="{$language.name}"> {/if} {/if} <span><!-- Flag image --><img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /><!-- /Flag image--><!--{$language.name|regex_replace:"/\s.*$/":""}--></span> {if $language.iso_code != $lang_iso} </a> {/if} </li> {/foreach} </ul> </div> {/if} <!-- /Block languages module --> You can download the tpl too if you prefer to replace it by the original. We recommend you make a backup or, better, rename the original file in case you have to restore it in the future. We hope you find this litte contributtion useful The default theme of the 1.6 Prestashop version is very comprehensive, but we missed the flags on the language selector, instead of (or plus) language text. We wanted to complete the original blocklanguages selector: into this: We have make little changes to do work flags on our customized default prestashop 1.6 theme, and want to share it with you: Basically, what we did was add these code lines to our "blocklanguages.tpl" file: <img style="border: solid 3px #fff; margin-right:5px;" src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /> Of course, you can modify the width and height of your flags and adapt your CSS as you need. We use 1.6.0.5 version and this is the full code on our "blocklanguages.tpl" file (that should work on all 1.6 versdions). As you can see, we have commented a line at the end of the tpl, to replace {$language.name|regex_replace:"/\s.*$/":""} by the flag image code. Here you are, the full content code in "../themes/default-bootstrap/modules/blocklanguages.tpl": {* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- Block languages module --> {if count($languages) > 1} <div id="languages-block-top" class="languages-block"> {foreach from=$languages key=k item=language name="languages"} {if $language.iso_code == $lang_iso} <div class="current"> <!-- Flag image --> <img style="border: solid 3px #fff; margin-right:5px;" src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /><!-- /Flag image --> <span>{$language.name|regex_replace:"/\s.*$/":""}</span> </div> {/if} {/foreach} <ul id="first-languages" class="languages-block_ul toogle_content"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected"{/if}> {if $language.iso_code != $lang_iso} {assign var=indice_lang value=$language.id_lang} {if isset($lang_rewrite_urls.$indice_lang)} <a href="{$lang_rewrite_urls.$indice_lang|escape:'html':'UTF-8'}" title="{$language.name}"> {else} <a href="{$link->getLanguageLink($language.id_lang)|escape:'html':'UTF-8'}" title="{$language.name}"> {/if} {/if} <span><!-- Flag image --><img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="32" height="22" /><!-- /Flag image--><!--{$language.name|regex_replace:"/\s.*$/":""}--></span> {if $language.iso_code != $lang_iso} </a> {/if} </li> {/foreach} </ul> </div> {/if} <!-- /Block languages module --> You can download the tpl too if you prefer to replace it by the original. We recommend you make a backup or, better, rename the original file in case you have to restore it in the future. We hope you find this litte contributtion useful All very nice. But after I replaced the code, I can not choose between the languages. In my case the German flag is seen but not English. Where is the error? All very nice. But after I replaced the code, I can not choose between the languages. In my case the German flag is seen but not English. Where is the error? Link to comment Share on other sites More sharing options...
0cx Posted December 1, 2014 Share Posted December 1, 2014 Pues en 1.6.9 no funciona esto.... Link to comment Share on other sites More sharing options...
lindertmedia Posted December 1, 2014 Share Posted December 1, 2014 Try this... <div id="languages_block_top"> <div id="countries"> <ul style="list-style:none;"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected_language"{/if} style="display:inline-block;margin:2px;"> {if $language.iso_code != $lang_iso} {assign var=indice_lang value=$language.id_lang} {if isset($lang_rewrite_urls.$indice_lang)} <a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$language.name}"> {else} <a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$language.name}"> {/if} {/if} <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> {if $language.iso_code != $lang_iso} </a> {/if} </li> {/foreach} </ul> </div> </div> 1 Link to comment Share on other sites More sharing options...
0cx Posted December 1, 2014 Share Posted December 1, 2014 Mi version de prestashop 1.6.9, es en español, quizas sea eso, porque no veo manera de meter eso blocklanguages.tpl Link to comment Share on other sites More sharing options...
Goyo Posted December 2, 2014 Share Posted December 2, 2014 Mi version de prestashop 1.6.9, es en español, quizas sea eso, porque no veo manera de meter eso blocklanguages.tpl Hola ocx, revisa lo que has hecho porque si funciona en la 1.6.0.9. Mira aquí. Saludos. Link to comment Share on other sites More sharing options...
booble Posted March 2, 2015 Share Posted March 2, 2015 Funciona con la 1.6.0.13?? Donde hay que meter las imágenes de las banderas?? Link to comment Share on other sites More sharing options...
Goyo Posted March 2, 2015 Share Posted March 2, 2015 Funciona con la 1.6.0.13?? Donde hay que meter las imágenes de las banderas?? Hola booble, no lo he probado en la 1.6.0.13 pero te debería funcionar. Con las imágenes de las banderas no tienes que hacer nada, tan sólo añadir los idiomas que necesites desde tu backoffice. Espero que te sirva. Hi booble, I haven't tested this with the version 1.6.0.13 but I suppose It will be running. With the flag images you have not to do nothing, only you have to add the languages from your backoffice. I hope to help you. Link to comment Share on other sites More sharing options...
PCWitcher Posted March 19, 2015 Share Posted March 19, 2015 Hola ocx, revisa lo que has hecho porque si funciona en la 1.6.0.9. Mira aquí. Saludos. Hi Do I have to change only blocklanguages.tpl or something else? Link to comment Share on other sites More sharing options...
Goyo Posted March 19, 2015 Share Posted March 19, 2015 Hi Do I have to change only blocklanguages.tpl or something else? Hi wiedzmin, to see the flag images only you have to change this file, also you can play with the css to obtain other result. Regards. Link to comment Share on other sites More sharing options...
PCWitcher Posted March 27, 2015 Share Posted March 27, 2015 (edited) Hi wiedzmin, to see the flag images only you have to change this file, also you can play with the css to obtain other result. Regards. Hi Goyo Not working for me, change this file and nothing, maybe I have to reset some cache? Regards Edited March 27, 2015 by wiedzmin (see edit history) Link to comment Share on other sites More sharing options...
Goyo Posted March 28, 2015 Share Posted March 28, 2015 Hi Goyo Not working for me, change this file and nothing, maybe I have to reset some cache? Regards Hi wiedzmin, Yes, It's possible you will have to clean cache in your browser and, also, in Prestashop back-office (Advanced Parameters -> Performance). You can do this, always if you don't obtain the result you are waiting after changes. Also, be sure you have selected the option "Force compilation" and Cache = NO in Advanced Parameters -> Performance. Please check the last options and be sure you download the file blocklanguages.zip you can find in the post #1 and unzip It, then copy/replace the file blocklanguages.tpl inside of the folder /your_theme/modules/blocklanguages/ If you don't solve this, don't hesitate to contact me with a private message and send me the Ftp access or, if you use TeamViwer, send me your connection data and we can do it toguether. I tested these changes with the version 1.6.0.14 and It's running, you can check here (I have added other Css changes). I hope to help you. Regards. Goyo. 1 Link to comment Share on other sites More sharing options...
PCWitcher Posted March 28, 2015 Share Posted March 28, 2015 Hi wiedzmin, Yes, It's possible you will have to clean cache in your browser and, also, in Prestashop back-office (Advanced Parameters -> Performance). You can do this, always if you don't obtain the result you are waiting after changes. Also, be sure you have selected the option "Force compilation" and Cache = NO in Advanced Parameters -> Performance. Please check the last options and be sure you download the file blocklanguages.zip you can find in the post #1 and unzip It, then copy/replace the file blocklanguages.tpl inside of the folder /your_theme/modules/blocklanguages/ If you don't solve this, don't hesitate to contact me with a private message and send me the Ftp access or, if you use TeamViwer, send me your connection data and we can do it toguether. I tested these changes with the version 1.6.0.14 and It's running, you can check here (I have added other Css changes). I hope to help you. Regards. Goyo. Big Big Thanks Goyo now working. Regards Wiedzmin Link to comment Share on other sites More sharing options...
Goyo Posted March 29, 2015 Share Posted March 29, 2015 Big Big Thanks Goyo now working. Regards Wiedzmin Ok, a pleasure to help you. You are welcome!!! Goyo. Link to comment Share on other sites More sharing options...
PCWitcher Posted March 29, 2015 Share Posted March 29, 2015 HI Goyo Can you tell me how you setup Layered navigation block? My not works, http://www.niedzielan-fashion.ie Regards Wiedzmin Link to comment Share on other sites More sharing options...
borbalher Posted May 6, 2015 Share Posted May 6, 2015 Hi wiedzmin, Yes, It's possible you will have to clean cache in your browser and, also, in Prestashop back-office (Advanced Parameters -> Performance). You can do this, always if you don't obtain the result you are waiting after changes. Also, be sure you have selected the option "Force compilation" and Cache = NO in Advanced Parameters -> Performance. Please check the last options and be sure you download the file blocklanguages.zip you can find in the post #1 and unzip It, then copy/replace the file blocklanguages.tpl inside of the folder /your_theme/modules/blocklanguages/ If you don't solve this, don't hesitate to contact me with a private message and send me the Ftp access or, if you use TeamViwer, send me your connection data and we can do it toguether. I tested these changes with the version 1.6.0.14 and It's running, you can check here (I have added other Css changes). I hope to help you. Regards. Goyo. Hi Goyo, I have Prestashop 1.6.0.11 and it doesn't work. I have "Force Compilation" and "Cache=No" in advanced options. I have also cleared Prestashop/browser cache. Any suggestion? Thanks in advance! PS: In my "blocklanguage.tpl" I don't have this line {$language.name|regex_replace:"/\s.*$/":""} 1 Link to comment Share on other sites More sharing options...
Goyo Posted May 8, 2015 Share Posted May 8, 2015 Hi Goyo, I have Prestashop 1.6.0.11 and it doesn't work. I have "Force Compilation" and "Cache=No" in advanced options. I have also cleared Prestashop/browser cache. Any suggestion? Thanks in advance! PS: In my "blocklanguage.tpl" I don't have this line {$language.name|regex_replace:"/\s.*$/":""} Hi borbalher, I don't test this in the version 1.6.0.11 but I can suppose it's useful also. Only you have to change the content of ../themes/your_theme/modules/blocklaguages.tpl for the content you will find in the post #1 or download the file and replace it. Later, clean cache in the backoffice and in the browser you are using. With this I suppose It will be run but, like I said you, I don't test this with the version 1.6.0.11. I hope to help you. Regards. Link to comment Share on other sites More sharing options...
D.Fenstec Posted July 30, 2015 Share Posted July 30, 2015 Hello everyoneSorry if I write on a thread of several months ago. I modified the file .tpl to see also the flags, now I would be interested to show languages in a single line. I tried to insert the code that vekia posted, to me it only adds a blank space after the name of the language, and the dropdown remains. I also tried the code posted from lindertmedia, that displays the languages in one line, but it seems a poorer code (also graphically is not the best), or perhaps it was used on PS 1.5, also the languages are displayed on the top left, and not top right as I want . Some other solution? Thank You Link to comment Share on other sites More sharing options...
Lire Posted October 3, 2015 Share Posted October 3, 2015 Thanks I served very helpful to my store http://salamotard.com Link to comment Share on other sites More sharing options...
Txanter Posted March 29, 2016 Share Posted March 29, 2016 Funciona con prestashop 1.6.1.4 Thanks Goyo Big master! Link to comment Share on other sites More sharing options...
Goyo Posted March 30, 2016 Share Posted March 30, 2016 Funciona con prestashop 1.6.1.4 Thanks Goyo Big master! Hola Txanter, encantado de poder ayudarte. Gracias por tu comentario. Link to comment Share on other sites More sharing options...
Socialmediacantabria Posted November 22, 2016 Share Posted November 22, 2016 Hi good afternoon, i change the file blcklanguajes.tpl but now not show the name of the languajes. How can i show flags and names in the same lines? Link to comment Share on other sites More sharing options...
AD01 Posted February 20, 2017 Share Posted February 20, 2017 Hello, idm : Hi good afternoon, i change the file blcklanguajes.tpl but now not show the name of the languajes. How can i show flags and names in the same lines? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now