Jump to content

How to change Language order 1.6


mechcalvin

Recommended Posts

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

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;
		}
	}

  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...
  • 4 years later...

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

image.thumb.png.a5d24b79dbd9f5b85ef21613c4cb989d.png

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...