Your IP : 3.145.15.129
<?
CModule::IncludeModule('iblock');
$virtualCategories = array();
foreach ($arGResult as $item) {
$virtualCategories [$item["UF_CATEGORY"]] [] = array(
"NAME" => $item["UF_NAME"], "LINK" => $item["UF_LINK"], "TYPE" => $item["UF_TYPE"] - 3
);
}
$arFilter = array('IBLOCK_ID' => 149, 'SECTION_ID' => false, "ACTIVE"=>"Y");
$rsSections = CIBlockSection::GetList(array('LEFT_MARGIN' => 'ASC'), $arFilter, false, array("*", "UF_*"));
$sections = array();
while ($arSection = $rsSections->GetNext()) {
$sections [$arSection['ID']] = array(
"ID" => $arSection['ID'],
"NAME" => $arSection['NAME'],
"LINK" => $arSection['SECTION_PAGE_URL'],
"LINK2" => $arSection['UF_LINK'],
"BAN_L_IMG" => CFile::GetPath($arSection["UF_BANNER_IMG"]),
"BAN_L_LINK" => $arSection["UF_BANNER_LINK"],
"BAN_D_IMG" => CFile::GetPath($arSection["UF_BANNER_D_IMG"]),
"BAN_D_LINK" => $arSection["UF_BANNER_D_LINK"],
);
}
$tree = CIBlockSection::GetTreeList(
$arFilter = Array('IBLOCK_ID' => 149, "ACTIVE"=>"Y"),
$arSelect = Array()
);
$thirtLevelSectons = array();
while ($section = $tree->GetNext()) {
if ($section["DEPTH_LEVEL"] == 3) {
$thirtLevelSectons [$section["IBLOCK_SECTION_ID"]][] = array(
"ID" => $section["ID"],
"NAME" => $section["NAME"],
"LINK" => $section["SECTION_PAGE_URL"]);
}
}
$tree = CIBlockSection::GetTreeList(
$arFilter = Array('IBLOCK_ID' => 149, "ACTIVE"=>"Y"),
$arSelect = Array()
);
while ($section = $tree->GetNext()) {
if ($section["DEPTH_LEVEL"] == 1) continue;
$sub = $thirtLevelSectons[$section["ID"]];
$virtuals = $virtualCategories[$section["ID"]];
if (!is_array($sub))
$sub = "";
if (!is_array($virtuals))
$virtuals = "";
if ($section["DEPTH_LEVEL"] == 2) {
$sections[$section["IBLOCK_SECTION_ID"]]["SECTIONS"][$section["ID"]] = array(
"ID" => $section["ID"],
"NAME" => $section["NAME"],
"LINK" => $section["SECTION_PAGE_URL"],
"SECTIONS" => $sub,
"VIRTUALS" => $virtuals,
);
}
}
// additional menu
$arFilter = array('IBLOCK_ID' => 106, 'SECTION_ID' => false, "ACTIVE"=>"Y");
$rsSections = CIBlockSection::GetList(array('SORT' => 'ASC'), $arFilter, false, array("*", "UF_*"));
$add_menu = array();
while ($arSection = $rsSections->GetNext()) {
// pre($arSection);
$elements = array();
$arSelect = Array("ID", "IBLOCK_ID", "NAME","PROPERTY_*");
$arFilter = Array("IBLOCK_ID" => IntVal(106), "IBLOCK_SECTION_ID" => $arSection['ID'], "ACTIVE" => "Y");
$res = CIBlockElement::GetList(array('SORT' => 'ASC'), $arFilter, false, Array("nPageSize" => 50), $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
// pre($arFields);
$arProps = $ob->GetProperties();
// pre($arProps);
$products = array();
foreach ($arProps["PRODUCTS"]["VALUE"] as $id){
$products [$id] = CCatalogProduct::GetByIDEx($id);
// $products [$id][]
}
// pre($products);
$elements [] = array(
"NAME"=>$arFields["NAME"],
"LINK"=>$arProps["IMG"]["VALUE"],// TODO may be error
"PRODUCTS"=>$products,
);
}
$add_menu [$arSection['ID']] = array(
"ID" => $arSection['ID'],
"NAME" => $arSection['NAME'],
"LINK" => $arSection['SECTION_PAGE_URL'],
"ELEMENTS" => $elements,
"UF_PRODUCTS"=>$arSection['UF_PRODUCTS'],
"UF_LINK"=>$arSection['UF_LINK'],
);
}
//pre($add_menu);
//pre($sections);
?>
<style>
.title-text:hover{
color: white!important;
}
</style>
<nav>
<div class="container">
<div class="row">
<!-- <div class="mm-toggle-wrap">-->
<!-- <div class="mm-toggle"><i class="fa fa-align-justify"></i></div>-->
<!-- <span class="mm-label">ВСЕ КАТЕГОРИИ</span></div>-->
<div class="col-md-3 col-sm-3 mega-container hidden-xs">
<!-- <div class="navleft-container">-->
<!-- <div class="mega-menu-title">-->
<!-- <h3><span>ВСЕ КАТЕГОРИИ</span></h3>-->
<!-- </div>-->
<!-- -->
<!-- <div class="mega-menu-category">-->
<!-- <ul class="nav">-->
<!-- --><?//$lastCount = 0;?>
<!-- --><?// foreach ($sections as $section): ?>
<!-- <li><a href="--><?//= $section["LINK"] ?><!--">--><?//= $section["NAME"] ?><!--</a>-->
<!-- --><?// if ($section["SECTIONS"]): ?>
<!-- <div class="wrap-popup" style="z-index: 1000">-->
<!-- <div class="popup">-->
<!-- <div class="row"style="z-index: 1000">-->
<!-- <div class="col-md-4 col-sm-6">-->
<!-- --><?//
// $count = -1;
// $sectionsCount = -1;
// ?>
<!-- --><?// foreach ($section["SECTIONS"] as $sub_section): ?>
<!-- --><?//
// $count++;
// if ($count >= 3 || $sectionsCount > 10) continue;
// ?>
<!-- <h3>-->
<!-- <a href="--><?//= $sub_section["LINK"] ?><!--"> --><?//= $sub_section["NAME"] ?><!--</a>-->
<!-- </h3>-->
<!-- --><?// if ($sub_section["SECTIONS"]): ?>
<!-- <ul class="nav">-->
<!-- --><?// foreach ($sub_section["SECTIONS"] as $sub_sub_section): $sectionsCount++;?>
<!-- <li>-->
<!-- <a href="--><?//= $sub_sub_section["LINK"] ?><!--">--><?//= $sub_sub_section["NAME"] ?><!--</a>-->
<!-- </li>-->
<!-- --><?// endforeach; ?>
<!-- </ul>-->
<!-- --><?// endif; ?>
<!-- <br>-->
<!-- --><?//$lastCount = $count;?>
<!-- --><?// endforeach; ?>
<!-- </div>-->
<!---->
<!-- --><?// if ( $sectionsCount >= 10 || count($section["SECTIONS"]) >= 4 ): ?>
<!-- <div class="col-md-4 col-sm-6 has-sep">-->
<!-- --><?//
// $count = -1;
// ?>
<!-- --><?// foreach ($section["SECTIONS"] as $sub_section): ?>
<!-- --><?//
// $count++;
// if ($count <= $lastCount ) continue;
// ?>
<!-- <h3>-->
<!-- <a href="--><?//= $sub_section["LINK"] ?><!--"> --><?//= $sub_section["NAME"] ?><!--</a>-->
<!-- </h3>-->
<!-- --><?// if ($sub_section["SECTIONS"]): ?>
<!-- <ul class="nav">-->
<!-- --><?// foreach ($sub_section["SECTIONS"] as $sub_sub_section): ?>
<!-- <li>-->
<!-- <a href="--><?//= $sub_sub_section["LINK"] ?><!--">--><?//= $sub_sub_section["NAME"] ?><!--</a>-->
<!-- </li>-->
<!-- --><?// endforeach; ?>
<!-- </ul>-->
<!-- --><?// endif; ?>
<!-- <br>-->
<!-- --><?// endforeach; ?>
<!-- </div>-->
<!-- --><?// endif; ?>
<!---->
<!-- --><?// if ($section["BAN_L_IMG"]): ?>
<!-- <div class="col-md-4 has-sep hidden-sm">-->
<!-- <div class="custom-menu-right">-->
<!-- <div class="box-banner menu-banner">-->
<!-- <div class="add-right"><a-->
<!-- href="--><?//= $section["BAN_L_LINK"] ?><!--"><img-->
<!-- src="--><?//= $section["BAN_L_IMG"] ?><!--"-->
<!-- alt="responsive"></a></div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- --><?// endif; ?>
<!---->
<!-- --><?// if ($section["BAN_D_IMG"]): ?>
<!-- <div class="col-sm-12"><a class="ads1"-->
<!-- href="--><?//= $section["BAN_D_LINK"] ?><!--"><img-->
<!-- class="img-responsive"-->
<!-- src="--><?//= $section["BAN_D_IMG"] ?><!--"-->
<!-- alt="bootstrap"></a>-->
<!-- </div>-->
<!-- --><?// endif; ?>
<!---->
<!---->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- --><?// endif; ?>
<!-- </li>-->
<!-- --><?// endforeach; ?>
<!-- </ul>-->
<!-- </div>-->
<!-- </div>-->
</div>
<div class="col-9 col-md-9 col-sm-9 jtv-megamenu">
<div class="mtmegamenu">
<ul class="">
<!-- <ul class="hidden-xs">-->
<?foreach ($add_menu as $section):?>
<?if($section["UF_PRODUCTS"]):?>
<li class="mt-root">
<div class="mt-root-item">
<div class="title title_font"><span class="title-text"><?=$section["NAME"]?></span></div>
</div>
<ul class="menu-items col-xs-12">
<?foreach ($section["ELEMENTS"] as $elem):;?>
<?foreach ($elem["PRODUCTS"] as $product):;?>
<li class="menu-item depth-1 product menucol-1-3 withimage">
<div class="product-item">
<div class="item-inner">
<div class="product-thumbnail">
<div class="icon-sale-label sale-left">Наш выбор</div>
<div class="pr-img-area"><a title="Product title here"
href="<?=$product["DETAIL_PAGE_URL"]?>">
<figure><img class="first-img"
src="<?=CFile::GetPath($product["DETAIL_PICTURE"])?>"
alt="html theme"> <img class="hover-img"
src="<?=CFile::GetPath($product["DETAIL_PICTURE"])?>"
alt="html Template">
</figure>
</a></div>
<div class="pr-info-area">
<div class="pr-button">
<div class="mt-button add_to_wishlist"><a
onclick="addToFavorites(<?= $product['ID'] ?>);"> <i
class="fa fa-heart"></i> </a></div>
<div class="mt-button add_to_compare"><a
onclick="addToCompare(<?= $product['ID'] ?>);"> <i
class="fa fa-signal"></i> </a></div>
<div class="mt-button quick-view"><a href="quick_view.html">
<i class="fa fa-search"></i> </a></div>
</div>
</div>
</div>
<div class="item-info">
<div class="info-inner">
<div class="item-title"><a title="Product title here"
href="<?=$product["DETAIL_PAGE_URL"]?>"><?=$product["NAME"]?> </a>
</div>
<div class="item-content">
<div class="rating"><i class="fa fa-star-o"></i> <i
class="fa fa-star-o"></i> <i
class="fa fa-star-o"></i> <i
class="fa fa-star-o"></i> <i
class="fa fa-star-o"></i></div>
<div class="item-price">
<div class="price-box"><span
class="regular-price"> <span class="price"><?=$product["PRICES"][1]["PRICE"]?> грн</span> </span>
</div>
</div>
<div class="pro-action">
<button onclick="buyProduct(<?= $product['ID'] ?>, 1);" type="button" class="add-to-cart">
<span> Купить</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
<?endforeach;?>
<?endforeach;?>
</ul>
</li>
<?else:?>
<li class="mt-root demo_custom_link_cms">
<?if($section["ELEMENTS"]):?>
<div class="mt-root-item">
<div class="title title_font"><a href="<?=$section["UF_LINK"]?>" class="title-text"><?=$section["NAME"]?></a></div>
</div>
<ul class="menu-items col-md-3 col-sm-4 col-xs-12">
<?foreach ($section["ELEMENTS"] as $sub_section):?>
<li class="menu-item depth-1">
<div class="title"><a href="<?=$sub_section["LINK"]?>"><span><?=$sub_section["NAME"]?></span></a></div>
</li>
<?endforeach;?>
</ul>
<?else:?>
<div class="mt-root-item">
<div class="title title_font"><a href="<?=$section["UF_LINK"]?>" class="title-text"><?=$section["NAME"]?></a></div>
</div>
<?endif;?>
</li>
<?endif;?>
<?endforeach;?>
</ul>
</div>
</div>
</div>
</div>
</nav>
<?//pre($add_menu)?>