php - find Prestashop shop available languages within a module -


good day all. i'm doing prestashop module, , i'm using logic in .tpl file:

{foreach $languages $lang}  ... {/foreach} 

i'd move kind of logic module php, , not .tpl file, because logic becoming little complex , don't templates logic in them.

the problem have can't find way languages within module (i'm not considering db queries @ stage, i'd switch brutal fetch in case didn't solve in more smooth way). actually, can retrieve actual language using:

$this->context->language->id 

it's cool isn't enough, need is:

  1. all current languages of shop
  2. all shops
  3. all languages of gives shop

point 1 important, point 2 , 3 considered because i'd scale solution in multishop environments.

does have clue on whre should start search?

does can answer point 1?

you can language class through static methods.

  1. languages of current shop: language::getlanguages(true, $this->context->shop->id);
  2. languages of shops language::getlanguages(true);
  3. languages of given shop language::getlanguages(true, $whatever_shop_id);

first parameter true active languages, set false if need languages. can specify third parameter true if wish retrieve language ids.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -