@soniksg

Почему в битриксе дублируется ссылка меню в нижние уровни меню?

Почему в битриксе дублируется ссылка меню в нижние уровни меню?

6274bf197c081225424864.png

6274bf600f2e3801089511.png

Это шаблон компонента меню
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$this->setFrameMode(true);
global $APPLICATION;
?>

<?
$arMunu = Array();
foreach($arResult as $index => $arItem) {
//      if ($arItem['DEPTH_LEVEL'] == 2)
//      {
//        $arItem['IS_PARENT'] = 0;
//        $arItem['PARAMS']['IS_PARENT'] = 0;
//      }
//
//      if ($arItem['DEPTH_LEVEL'] > 2)
//        continue;

  $arMunu[] = $arItem;
}

//dbg($arMunu);
$arResult = $arMunu;
//dbgz($arResult);
$prevLvl = 0;
$arLevelsInc = Array(3);
$allproductShow = $firstPaste = false;
foreach($arResult as $arItem)
{
  if($arItem['PARAMS']['ICON'])
  {
    if(in_array($arItem['DEPTH_LEVEL'], $arLevelsInc) && $firstPaste === false) {
      $allproductShow = true;
    } else{
      $allproductShow = false;
    }

    if($arItem['DEPTH_LEVEL'] == 1 || $arItem['DEPTH_LEVEL'] == 2) {
      $allProductLink = $arItem['LINK'];
      $firstPaste = false;
      if($arItem['SELECTED']) {
        $allProductSelected = true;
        foreach($arResult as $arMenu) {
          if(in_array($arMenu['DEPTH_LEVEL'], $arLevelsInc) && $arMenu['SELECTED'] == true) {
            $allProductSelected = false;
            break;
          }
        }
      }
    }
  }

$ex_level = [];

  if ($arItem['DEPTH_LEVEL'] < $prevLvl)
    echo str_repeat('</div></div>', $prevLvl-$arItem['DEPTH_LEVEL']);

  if ($arItem['DEPTH_LEVEL'] > 3)
    continue;

  $isParent = (!empty($arItem['IS_PARENT'])) ? true : false;

  ?>

  <?if($allproductShow):?>
    <?$firstPaste = true;?>
    <div class="item-wrap <?if($allProductSelected):?> active active-init<?endif?>">
      <a class="item <?if($allProductSelected):?> active<?endif?>" href="<?=$allProductLink?>">Все товары</a>
    </div>
  <?endif?>

  <div class="item-wrap<?if($isParent):?> is-subs<?endif?><?if($arItem['DEPTH_LEVEL'] == 1):?> head-item<?endif?><?if($arItem['SELECTED']):?> active active-init<?endif?>">
	  <a class="item<?if($arItem['SELECTED']):?> active<?endif?><?if($arItem['IS_PARENT'] === true):?> section-page<?endif?><?if(!empty($arItem['PARAMS']['ICON'])):?> icon-wrap<?endif?>" <?if($arItem['IS_PARENT'] == false):?>href="<?=$arItem['LINK']?>"<?endif;?>><?if(!empty($arItem['PARAMS']['ICON'])):?><img class="icon" src="<?=$arItem['PARAMS']['ICON']?>" /><?endif?><?=$arItem['TEXT']?></a>
    <?if ($isParent):?>
      <div class="arrow-to-subs"></div>
      <div class="section">

		<div class="item-wrap">
      <a class="item" href="<?=$arItem['LINK']?>"><?=$arItem['TEXT']?></a>
		  </div>
    <?else:?>
      </div>
    <?endif?>
  <?
  $prevLvl = $arItem['DEPTH_LEVEL'];

  if($arItem['DEPTH_LEVEL'] == 2) {
    $allProductSelected = false;
  }
}

if ($prevLvl > 1)
  echo str_repeat('</div></div>', $prevLvl-1);
?>
  • Вопрос задан
  • 148 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы