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:
- all current languages of shop
- all shops
- 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.
- languages of current shop:
language::getlanguages(true, $this->context->shop->id);
- languages of shops
language::getlanguages(true);
- 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
Post a Comment