superskyman100 Posted April 19, 2019 Share Posted April 19, 2019 (edited) Salut à tous, Je voudrais modifier l'ordre d'apparition des drapeaux sur le selecteur des langues, car je viens nouvellement d'ajouter la langue 'Australien' pour des reaisons de specificites de marché J'ai deja fourni un GROS TRAVAIL de traduction, donc tout effacer et repartir dans l'ordre est juste hors de question le problème c'est que du coup, vu que j'ai ajouté cette langue en dernier, elle apparait egalement en dernier sur le menu deroulant, alors que logiquement elle devrait se trouver juste en dessous de l'anglais-americain idealement je voudrais pouvoir arranger la liste des langues dans le bloc, de haut en bas : {anglais-US, anglais-EN, anglais-AU} {Espagnol, Francais, Italien, Portugais} {Allemand} Donc, par groupe de langues 'cousines' Sauf qu'une fois encore, une fois les langues créées je ne peux plus modifier leur ordre d'apparition... Qu'un aurait une solution 'légère' ? Merci Aurelien Edited January 24, 2020 by superskyman100 (see edit history) Link to comment Share on other sites More sharing options...
Eolia Posted April 19, 2019 Share Posted April 19, 2019 réorganiser le tableau envoyé en Smarty dans le php du module blocklanguages Link to comment Share on other sites More sharing options...
superskyman100 Posted April 19, 2019 Author Share Posted April 19, 2019 Ce PHP là ?... j'y comprends juste rien je ne suis pas programmeur.... <?php /* * 2007-2015 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-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) { exit; } use PrestaShop\PrestaShop\Core\Module\WidgetInterface; class Ps_Languageselector extends Module implements WidgetInterface { private $templateFile; public function __construct() { $this->name = 'ps_languageselector'; $this->author = 'PrestaShop'; $this->version = '2.0.2'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->trans('Language selector block', array(), 'Modules.Languageselector.Admin'); $this->description = $this->trans('Adds a block allowing customers to select a language for your store\'s content.', array(), 'Modules.Languageselector.Admin'); $this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_); $this->templateFile = 'module:ps_languageselector/ps_languageselector.tpl'; } public function renderWidget($hookName = null, array $configuration = []) { $languages = Language::getLanguages(true, $this->context->shop->id); if (1 < count($languages)) { $this->smarty->assign($this->getWidgetVariables($hookName, $configuration)); return $this->fetch($this->templateFile); } return false; } public function getWidgetVariables($hookName = null, array $configuration = []) { $languages = Language::getLanguages(true, $this->context->shop->id); foreach ($languages as &$lang) { $lang['name_simple'] = $this->getNameSimple($lang['name']); } return array( 'languages' => $languages, 'current_language' => array( 'id_lang' => $this->context->language->id, 'name' => $this->context->language->name, 'name_simple' => $this->getNameSimple($this->context->language->name) ) ); } private function getNameSimple($name) { return preg_replace('/\s\(.*\)$/', '', $name); } } Link to comment Share on other sites More sharing options...
Eolia Posted April 19, 2019 Share Posted April 19, 2019 Ok... vous êtes sur 1.7... Dans cette boucle là foreach ($languages as &$lang) { $lang['name_simple'] = $this->getNameSimple($lang['name']); } Mais il faudrait connaitre les ID de vos langues pour pouvoir les ré-organiser Link to comment Share on other sites More sharing options...
superskyman100 Posted April 19, 2019 Author Share Posted April 19, 2019 oui je suis en PS 1.7.4 🙂 Pièce jointe les 'id'... mais tjs aucune idée de comment faire .... Link to comment Share on other sites More sharing options...
superskyman100 Posted April 19, 2019 Author Share Posted April 19, 2019 hum désolé mais je sais pas du tout comment faire... je cherche dans les forums ici et là, mais la pêche n'est pas évidente... Link to comment Share on other sites More sharing options...
superskyman100 Posted April 19, 2019 Author Share Posted April 19, 2019 (edited) Bon ben j'ai l'impression vous m'avez lâché en cours de route.... 😥 si vous pouviez me donner un exemple de modif avec les id de langue, je pourrais faire qq chose mais là je suis largué... Edited April 19, 2019 by superskyman100 (see edit history) Link to comment Share on other sites More sharing options...
superskyman100 Posted April 19, 2019 Author Share Posted April 19, 2019 Bon, plus personne, c'est bien dommage, il me semblait le plus dur était fait........... Link to comment Share on other sites More sharing options...
Performance Agency Posted April 19, 2019 Share Posted April 19, 2019 Bonjour, Vous avez un tableau de $languages avec un ordre défini (1,4,6,7,17...) Il vous faut un nouveau tableau qui donnerait un tout nouvel ordre. Il faut que dans votre boucle foreach vous remplissiez ce nouveau tableau selon votre ordre choisi. Link to comment Share on other sites More sharing options...
Eolia Posted April 19, 2019 Share Posted April 19, 2019 Vos captures sont difficilement lisibles et on a un boulot aussi^^ Essayez ceci en remplacement du code existant: $languages2 = array(); $position = array(1 => 0, 35 => 1, 4 => 2, 6 => 3, 17 => 4, 18 => 5, 7 => 6); foreach ($languages as $key => &$lang) { $lang['name_simple'] = $this->getNameSimple($lang['name']); $languages2[$position[$lang['id_lang']] = $lang; } return array( 'languages' => $languages2, 'current_language' => array( 'id_lang' => $this->context->language->id, 'name' => $this->context->language->name, 'name_simple' => $this->getNameSimple($this->context->language->name) ) 1 Link to comment Share on other sites More sharing options...
superskyman100 Posted April 19, 2019 Author Share Posted April 19, 2019 ok, excusez moi pour le harcelement ...et surtout, merci beaucoup !!! 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