Daffuzz Posted August 24, 2017 Share Posted August 24, 2017 Hello! I have PrestaShop 1.7.2.0 and I can't find a blocklanguages.tpl file, how can I take flag icons in language switcher? Link to comment Share on other sites More sharing options...
cswebsolution Posted October 10, 2017 Share Posted October 10, 2017 Hi everyone! The blocklanguages.tpl file there isn't in prestashop 1.7. The new file is ps_languageselector.tpl and also i 've looking for the way to see on top of menu the flags icons on my site. Somebody can help us to fix the issue? Link to comment Share on other sites More sharing options...
cswebsolution Posted October 18, 2017 Share Posted October 18, 2017 up Link to comment Share on other sites More sharing options...
cswebsolution Posted October 27, 2017 Share Posted October 27, 2017 Sorry but the solution seems does't works. Where i've to put this part of code? Link to comment Share on other sites More sharing options...
Daffuzz Posted October 30, 2017 Author Share Posted October 30, 2017 I can't find to put in, where exactly i had copy it? Link to comment Share on other sites More sharing options...
cswebsolution Posted November 2, 2017 Share Posted November 2, 2017 THANK YOU SO MUCH!! It works very well! Thank you so much horiatb Link to comment Share on other sites More sharing options...
Daffuzz Posted November 2, 2017 Author Share Posted November 2, 2017 On 2017.10.31. at 2:36 PM, horiatb said: In your theme: themes/classic/modules/ps_languageselector replace the content of ps_languageselector.tpl with this: {** * 2007-2017 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License 3.0 (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: * https://opensource.org/licenses/AFL-3.0 * 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 license@prestashop.com 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 <contact@prestashop.com> * @copyright 2007-2017 PrestaShop SA * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaShop SA *} <div id="_desktop_language_selector"> <div class="language-selector-wrapper"> <span id="language-selector-label" class="hidden-md-up">{l s='Language:' d='Shop.Theme.Global'}</span> <div class="language-selector dropdown js-dropdown"> <button data-toggle="dropdown" class="hidden-sm-down btn-unstyle" aria-haspopup="true" aria-expanded="false" aria-label="{l s='Language dropdown' d='Shop.Theme.Global'}"> <span class="expand-more">{$current_language.name_simple}</span> <i class="material-icons expand-more"></i> </button> <ul class="dropdown-menu hidden-sm-down" aria-labelledby="language-selector-label"> {foreach from=$languages item=language} <li {if $language.id_lang == $current_language.id_lang} class="current" {/if}> <a href="{url entity='language' id=$language.id_lang}" class="dropdown-item"><img class="lang-flag" src="{$urls.img_lang_url}{$language.id_lang}.jpg"/>{$language.name_simple}</a> </li> {/foreach} </ul> <select class="link hidden-md-up" aria-labelledby="language-selector-label"> {foreach from=$languages item=language} <option value="{url entity='language' id=$language.id_lang}"{if $language.id_lang == $current_language.id_lang} selected="selected"{/if}>{$language.name_simple}</option> {/foreach} </select> </div> </div> </div> It should work, but you need to have the flag images for each language uploaded. I dont now, but for me not working. Link to comment Share on other sites More sharing options...
cswebsolution Posted November 2, 2017 Share Posted November 2, 2017 You have to change all the template file with this above. I've also put only the flag on the header on the selection languages button. Link to comment Share on other sites More sharing options...
Daffuzz Posted November 2, 2017 Author Share Posted November 2, 2017 I changed template file, but i dont understand where i had to change to flag pic, in localization/languages I change but nothing happens. Link to comment Share on other sites More sharing options...
cswebsolution Posted November 2, 2017 Share Posted November 2, 2017 Have you the languages selector on the header of your site? Link to comment Share on other sites More sharing options...
Daffuzz Posted November 2, 2017 Author Share Posted November 2, 2017 Yes Link to comment Share on other sites More sharing options...
cswebsolution Posted November 2, 2017 Share Posted November 2, 2017 Have you also the images of the languages installed in you presta shop theme? Link to comment Share on other sites More sharing options...
Daffuzz Posted November 2, 2017 Author Share Posted November 2, 2017 Yes, in themes/classic/modules/ps_languageselector folder Link to comment Share on other sites More sharing options...
cswebsolution Posted November 2, 2017 Share Posted November 2, 2017 the images is on www.yoursite.com/img/l Link to comment Share on other sites More sharing options...
Daffuzz Posted November 2, 2017 Author Share Posted November 2, 2017 (edited) I dont have that site, when I go there it jumps to my home page Edited November 2, 2017 by Daffuzz (see edit history) Link to comment Share on other sites More sharing options...
Daffuzz Posted November 3, 2017 Author Share Posted November 3, 2017 20 hours ago, Daffuzz said: I dont have that site, when I go there it jumps to my home page I cant enter it, it shows Forbidden You don't have permission to access /img/l/ on this server. Link to comment Share on other sites More sharing options...
cswebsolution Posted November 4, 2017 Share Posted November 4, 2017 You must change the authorization in your site's folder. You can only view the folder in ftp not from the browse Link to comment Share on other sites More sharing options...
nadie Posted March 12, 2018 Share Posted March 12, 2018 hace 20 minutos, ndiaga dijo: You shoud use /img/l/ instead. Here is how it works : http://prestatuts.com/tutorials/prestashop-1-7-display-language-flags/ According to your instruction manual you place the route manually. Attachment Capture I have a tutorial in Spanish of 2017 ((April 9, 2017) about the language flags in Prestashop 1.7 published on my blog and it is better to use the global variable, to refer to the directory {$urls.img_lang_url} Sorry for my English Link to comment Share on other sites More sharing options...
nadie Posted March 12, 2018 Share Posted March 12, 2018 hace 3 minutos, ndiaga dijo: Hi, thanks for the suggestion. But that url can cause trouble in multilangual environment. So I decided to put hard code the URL since it will be the same in all shops. And {$urls.img_lang_url} = /img/l/ So what is the point? I think In my personal opinion it is always better to use the global variables available to make use of the "established" routes, if it is a different (new) route than usual then if it makes sense, but if it is the same route, I think it is better to use the global variable, which already automatically references the /img/l/ directory, placing only {$urls.img_lang_url} If it causes problems in multilanguage, then it is better to fix the problem in the origin. Sorry for my English Link to comment Share on other sites More sharing options...
nadie Posted March 12, 2018 Share Posted March 12, 2018 (edited) hace 1 hora, ndiaga dijo: Why use a variable if you know that the variable is just displaying this string : '/img/l/' ? If you put in smarty {$urls.img_lang_url} you will see the path '/img/l/' . The variable is just a convention to make life easy and avoid memorisations. But me I know where the flags are stored, so I just call that folder. If it was shop url for example {$base_dir} , yes I would use the variable because that varible displays the shop's URL not an existing folder that will never change. In PrestaShop 1.6 you have this variable {$img_lang_url} and in PrestaShop 1.7 you have {$urls.img_lang_url} so you see? They both call '/img/l/' . To avaoid confusion to the users, I just call that folder. Some 1.6 users could read that tutorial too. I understand you perfectly, but the code should be as clean as possible. But I prefer to use the variables before placing the route manually. Although it prints the same value, by organization and clean code it is better to use variables. Neither are we going to fight. hehehe Sorry for my english, @ndiaga If you want I delete my messages (logically, I leave your answer without deleting). Edited March 12, 2018 by nadie (see edit history) Link to comment Share on other sites More sharing options...
Daffuzz Posted March 13, 2018 Author Share Posted March 13, 2018 (edited) 16 hours ago, ndiaga said: Ok, it's best practice to use a variable. You win the game. Thanks for your suggestion. Don't delete any comment leave the user to decide what to do. I will be even glad to see you comment in my blog : http://prestatuts.com/tutorials/prestashop-1-7-display-language-flags/ I try your sugestions, but for me not working, when I change code, fronty page looks like this and language selector don't work: Edited March 13, 2018 by Daffuzz (see edit history) Link to comment Share on other sites More sharing options...
Daffuzz Posted March 13, 2018 Author Share Posted March 13, 2018 1 minute ago, ndiaga said: Can you please give me the link to your website? did you put '/img/l/' in image scr? https://vairumtirdznieciba.greenhive.lv/en/ Link to comment Share on other sites More sharing options...
Daffuzz Posted March 13, 2018 Author Share Posted March 13, 2018 5 minutes ago, Daffuzz said: https://vairumtirdznieciba.greenhive.lv/en/ I add the correct source Link to comment Share on other sites More sharing options...
Daffuzz Posted March 15, 2018 Author Share Posted March 15, 2018 On 2018.03.13. at 4:57 PM, ndiaga said: I see it's working now. Or you meant something else? And you menu is not a drop down one... Now language flags are working, but I can't switch languages Link to comment Share on other sites More sharing options...
Daffuzz Posted March 19, 2018 Author Share Posted March 19, 2018 On 2018.03.16. at 3:18 PM, ndiaga said: And what happends if when you switch to original content without flags? In orginal all is working Link to comment Share on other sites More sharing options...
Daffuzz Posted March 20, 2018 Author Share Posted March 20, 2018 17 hours ago, ndiaga said: Please follow this guide: http://prestatuts.com/tutorials/prestashop-1-7-display-language-flags/ I'l try for this guide, but problem is the same, flags shows but language selector don't work Link to comment Share on other sites More sharing options...
Yankee Store Posted November 11, 2019 Share Posted November 11, 2019 (edited) Hello I am using Prestahop 1.7.6 I am looking to sort the language in the Languageselector drop down menu by the Language Name in asc order . can someone help me how to code that ? Thank You Edited November 11, 2019 by ambiancedelamaison.f (see edit history) Link to comment Share on other sites More sharing options...
Sashok Posted December 8, 2019 Share Posted December 8, 2019 On 11/11/2019 at 11:59 AM, Yankee Store said: Hello I am using Prestahop 1.7.6 I am looking to sort the language in the Languageselector drop down menu by the Language Name in asc order . can someone help me how to code that ? Thank You я создал в таблице ps_lang колонку mysort ALTER TABLE `ps_lang` ADD `mysort` INT NOT NULL AFTER `is_rtl`; и проставил значения нужной мне сортировки UPDATE `webpcstudio`.`ps_lang` SET `mysort` = '1200' WHERE `ps_lang`.`id_lang` = 15; UPDATE `webpcstudio`.`ps_lang` SET `mysort` = '1300' WHERE `ps_lang`.`id_lang` = 13; ... + override: /override/classes/Language.php <?php class Language extends LanguageCore { public static function loadLanguages() { self::$_LANGUAGES = array(); $sql = 'SELECT l.*, ls.`id_shop` FROM `' . _DB_PREFIX_ . 'lang` l LEFT JOIN `' . _DB_PREFIX_ . 'lang_shop` ls ON (l.id_lang = ls.id_lang) order by l.`mysort`'; $result = Db::getInstance()->executeS($sql); foreach ($result as $row) { $idLang = (int) $row['id_lang']; if (!isset(self::$_LANGUAGES[$idLang])) { self::$_LANGUAGES[$idLang] = $row; } self::$_LANGUAGES[$idLang]['shops'][(int) $row['id_shop']] = true; } } } Link to comment Share on other sites More sharing options...
ballashop Posted July 7, 2021 Share Posted July 7, 2021 Hi, @nadie thanks a lot, I recommend that you follow his instructions. if you do not see the flags check that they are present in the folder. Please see the link via your browser's code analysis tools. Bye. Balla 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