@version(2)
@php
$ss_cats = [];
$ss_shop_mid = trim((string)($hr->shop_mid ?? ''));
if ($ss_shop_mid === '')
{
foreach (ModuleModel::getMidList((object)['module' => 'commerce'], ['mid']) ?: [] as $ss_row)
{
$ss_shop_mid = (string)($ss_row->mid ?? '');
break;
}
}
if (($hr->use_shop_menu ?? 'Y') !== 'N' && $ss_shop_mid !== '')
{
$ss_out = executeQuery('commerce.getCategoryList', (object)['is_active' => 'Y']);
if ($ss_out->toBool() && !empty($ss_out->data))
{
$ss_rows = is_array($ss_out->data) ? $ss_out->data : [$ss_out->data];
$ss_child = [];
foreach ($ss_rows as $ss_row)
{
if (empty($ss_row->category_srl)) { continue; }
$ss_row->title = \Context::replaceUserLang((string)$ss_row->title);
$ss_child[(int)$ss_row->parent_srl][] = $ss_row;
}
foreach ($ss_child[0] ?? [] as $ss_top)
{
$ss_top->kids = $ss_child[(int)$ss_top->category_srl] ?? [];
$ss_cats[] = $ss_top;
}
}
}
$ss_shop_url = $ss_shop_mid !== '' ? getUrl('', 'mid', $ss_shop_mid) : '';
$ss_amp = strpos($ss_shop_url, '?') === false ? '?' : '&';
$hr_langs = \Context::get('lang_supported');
$hr_langs = is_array($hr_langs) ? $hr_langs : [];
$hr_lang_now = \Context::getLangType();
$hr_lang_uri = (string)($_SERVER['REQUEST_URI'] ?? '/');
$hr_lang_uri = preg_replace('/([?&])l=[^&]*/', '$1', $hr_lang_uri);
$hr_lang_uri = preg_replace('/[?&]+$/', '', $hr_lang_uri);
$hr_lang_uri = str_replace('&&', '&', $hr_lang_uri);
$hr_lang_sep = strpos($hr_lang_uri, '?') === false ? '?' : '&';
@endphp