equiox Posted April 12, 2010 Share Posted April 12, 2010 If I for example have the flag order like:English Spanish Frenchbut want to have it likeFrench Spanish EnglishHow should I do that? If I change the Language id in the database so the languages have the id in the order I want like1 French 2 Spanish 3 English it arranges them correctly but it messes up among other things the cart so that when I have French selected the shopping cart is in English and vice versa.I found where in the code is outputs the languages (see below) but I don't know enough PHP to alter the sorting.Any help appreciated. <!-- Block languages module --> {foreach from=$languages key=k item=language name="languages"} {if $language.iso_code != $lang_iso}getLanguageLink($language.id_lang, $language.name)}" title="{$language.name}">{/if} {if $language.iso_code != $lang_iso}{/if} {/foreach} [removed] $('ul#first-languages li:not(.selected_language)').css('opacity', 0.3); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.3); {rdelim}); [removed] <!-- /Block languages module --> Link to comment Share on other sites More sharing options...
msk69 Posted April 12, 2010 Share Posted April 12, 2010 I think this is a tricky one, though i'm not sure, as default english is 1, you may try on a fresh installation to remove the english language, then add spanish and then add english again.Do it on a test first, not live! Link to comment Share on other sites More sharing options...
rocky Posted April 13, 2010 Share Posted April 13, 2010 Since the order you want happens to be the reverse of what you have, you can add the following to line 47 of modules/blocklanguages/blocklanguages.php (in Prestashop v1.2.5): $languages = array_reverse($languages); Link to comment Share on other sites More sharing options...
equiox Posted April 13, 2010 Author Share Posted April 13, 2010 Thanks a bunch, that did the trick. Link to comment Share on other sites More sharing options...
Steppo Posted May 17, 2010 Share Posted May 17, 2010 Great Gurus;))) Great! Running prestashop 1.2.5 and i think it should be line 37 instead... At least i have only 41 lines in my .php//CheersStefan Link to comment Share on other sites More sharing options...
Laci Posted February 11, 2011 Share Posted February 11, 2011 Hi,in case somebody needs to define a specific order instead of reverse, check out this thread:http://www.prestashop.com/forums/viewthread/12376/general_discussion/language_order/Cheers,Laci Link to comment Share on other sites More sharing options...
joseantgv Posted October 3, 2013 Share Posted October 3, 2013 For PS 1.5.4.1 I override the following class in classes/Language.php: public static function getLanguages($active = true, $id_shop = false) { if (!self::$_LANGUAGES) Language::loadLanguages(); $languages = array(); foreach (self::$_LANGUAGES as $language) { if ($active && !$language['active'] || ($id_shop && !isset($language['shops'][(int)$id_shop]))) continue; $languages[] = $language; } usort($languages, function($a, $ { //language iso_code in the desired order: $new_order = array("es", "en"); foreach($new_order as &$value) { if ($a["iso_code"]==$value) return -1; if ($b["iso_code"]==$value) return 1; } }); return $languages; } 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