mechcalvin Posted May 15, 2016 Share Posted May 15, 2016 By default English is the first in language selector, how can I change other language to become the first? Link to comment Share on other sites More sharing options...
vekia Posted May 15, 2016 Share Posted May 15, 2016 at the moment it is not possible in prestashop (to order languages). if you want to change order only in block languages addon - it requires customization of this module, there is no other way sadly speaking Link to comment Share on other sites More sharing options...
mechcalvin Posted May 15, 2016 Author Share Posted May 15, 2016 Thahks for your reply, i searched one of your old post in 1.5.6: https://www.prestashop.com/forums/topic/307439-how-can-change-the-order-of-language-flags-in-156/ this doesn't work anymore in 1.6? If it required to customization of the module, where should i look at? Link to comment Share on other sites More sharing options...
El Patron Posted May 15, 2016 Share Posted May 15, 2016 Thahks for your reply, i searched one of your old post in 1.5.6: https://www.prestashop.com/forums/topic/307439-how-can-change-the-order-of-language-flags-in-156/ this doesn't work anymore in 1.6? If it required to customization of the module, where should i look at? this works in 1.6, just put on my shop... I did not do an ovrride I changed function directlly in classes/Language.php 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.name ASC '; $result = Db::getInstance()->executeS($sql); foreach ($result as $row) { if (!isset(self::$_LANGUAGES[(int)$row['id_lang']])) self::$_LANGUAGES[(int)$row['id_lang']] = $row; self::$_LANGUAGES[(int)$row['id_lang']]['shops'][(int)$row['id_shop']] = true; } } 1 Link to comment Share on other sites More sharing options...
mechcalvin Posted May 16, 2016 Author Share Posted May 16, 2016 Thanks, i did that but still English become the first because it is ordered by their language name, not ID, i want to be ID=4, Traditional Chinese ID=3, Simplify Chinese ID=1, English is it possible? Link to comment Share on other sites More sharing options...
jeff8899 Posted July 19, 2016 Share Posted July 19, 2016 (edited) hi, mechcalvin edit the code to below. it should show up the way you want. LEFT JOIN `'._DB_PREFIX_.'lang_shop` ls ON (l.id_lang = ls.id_lang) ORDER BY l.id_lang DESC'; Edited July 19, 2016 by jeff8899 (see edit history) Link to comment Share on other sites More sharing options...
Prince Raafet Posted August 30, 2018 Share Posted August 30, 2018 On 15/05/2016 at 9:42 AM, vekia said: at the moment it is not possible in prestashop (to order languages). if you want to change order only in block languages addon - it requires customization of this module, there is no other way sadly speaking Link to comment Share on other sites More sharing options...
marcpochet Posted December 21, 2022 Share Posted December 21, 2022 If you want change the order in Prestashop 1.6 / 1.7 Simply add an INTEGER field on the SQL table _lang (ex: ordre_langue) and givethe order value to each langage Then go to classes/Language.php and check for the function loadLanguages() and add ORDER BY THE NEW field $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 `ordre_langue`'; 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