Здравствуйте.
Как сделать вместо выбора языка выбор интернет магазина. Вот что я нашёл в интернете.
XXXXX на желаемый:
override \ modules \ ps_languageselector \ ps_languageselector.php
<?php
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
if (!defined('_PS_VERSION_'))
exit;
class Ps_LanguageselectorOverride extends Ps_Languageselector implements WidgetInterface
{
public function install()
{
if (!parent::install() || !$this->registerHook('XXXXXX'))
return false;
return true;
}
public function getWidgetVariables($hookName = null, array $configuration = [])
{
$id_shop = (int)$this->context->shop->id;
$id_group = (int)$this->context->shop->id_shop_group;
$shop = new Shop($id_shop);
$shopsList = $shop::getShops(false, $id_group);
foreach ($shopsList as $index => $currShop) {
$shopsList[$index]['lang'] = Language::getLanguages(true, $currShop['id_shop'])[0];
}
return array(
'shopsGroup' => $shopsList,
'currentShop' => $id_shop
);
}
public function hookDisplayXXXXXX($params)
{
$shopsList = $this->getWidgetVariables();
if (1 < count($shopsList['shopsGroup'])) {
$this->smarty->assign($shopsList);
return $this->fetch('module:ps_languageselector/ps_languageselector.tpl');
}
return false;
}
}
Вставьте сюда: themes\classic\modules\ps_languageselector\ps_languageselector.tpl
<div id="mod-ps-languageselector">
<h4>{l s='Language:' d='Shop.Theme.Global'}</h4>
{if isset($shopsGroup)}
{foreach from=$shopsGroup item=shop}
<a href="http://{$shop.domain}" class="{if $shop.id_shop == $currentShop}active{/if}">
{if isset($shop.lang.id_lang)}
<img src="/img/l/{$shop.lang.id_lang}.jpg" alt="{$shop.lang.language_code}" title="{$shop.lang.name}" />
{else}
<img src="/img/l/none.jpg" alt="Flag no found">
{/if}
</a>
{/foreach}
{/if}
</div>