Answer the question
In order to leave comments, you need to log in
Cycle in Bitrix filter?
Good evening everyone.
There is a code like this:
<?
$res = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 6, "ACTIVE"=>"Y"), false, false, array("ID", "IBLOCK_ID", "PROPERTY_VENDOR"));
$vendor = array();
while($ob = $res->GetNextElement()){
$arFields = $ob->GetFields();
$vendRes = CIBlockElement::GetByID($arFields["PROPERTY_VENDOR_VALUE"]);
if($ar_vend = $vendRes->GetNext()){
if (in_array($ar_vend['NAME'], $vendor) == false){
$vendor[$ar_vend['ID']] = $ar_vend['NAME'];
}
}
}
if(!empty($vendor)){
echo "
<ul class=\"dropdown-menu dropdown-menu-right multi-column columns-3\" aria-labelledby=\"dropdownMenu1\">
<form method='post' action='{$APPLICATION->GetCurDir()}'>
<input type='hidden' value='Y' name='setfilter'><div class=\"row\">
<div class=\"col-sm-12\">
<ul class=\"multi-column-dropdown\">
";
foreach($vendor as $id=>$val):
if (isset($_SESSION['filter']))
if (in_array($val, $_SESSION['filter']) || $val == $_SESSION['filter'])
$checked = ' checked';
else
$checked = '';
?>
<li>
<input type="checkbox"<?=$checked?> value="<?=$val?>" name="vendor[]" id="<?=$id?>"><label for="<?=$id?>"><?=$val?></label>
</li>
<?
endforeach;
echo "
<div class='form-but-wrap'>
<div class='form-but'><input type='submit' value='Фильтр'></div>
<div class='form-but'><input type='submit' onclick='filter_clear();' value='Сброс'></div>
<div class='clear'></div>
</div>
</div>
</div></ul>
</form>
</ul>
";
}
?>
<div class="row">
<div class="col-sm-12">
<ul class="multi-column-dropdown">
<li>
<input type="checkbox" value="1" name="vendor[]" id="21"><label for="21">1</label>
</li>
<li>
<input type="checkbox" value="2" name="vendor[]" id="23"><label for="23">2</label>
</li>
<li>
<input type="checkbox" value="3" name="vendor[]" id="13"><label for="13">3</label>
</li>
<li>
<input type="checkbox" value="4" name="vendor[]" id="26"><label for="26">4</label>
</li>
<li>
<input type="checkbox" value="5" name="vendor[]" id="27"><label for="27">5</label>
</li>
<li>
<input type="checkbox" value="6" name="vendor[]" id="28"><label for="28">6</label>
</li>
<li>
<input type="checkbox" value="7" name="vendor[]" id="29"><label for="29">7</label>
</li>
<li>
<input type="checkbox" value="8" name="vendor[]" id="16"><label for="16">8</label>
</li>
<li>
<input type="checkbox" value="9" name="vendor[]" id="25"><label for="25">9</label>
</li>
<li>
<input type="checkbox" value="10" name="vendor[]" id="20"><label for="20">10</label>
</li>
<li>
<input type="checkbox" value="11" name="vendor[]" id="14"><label for="14">11</label>
</li>
<li>
<input type="checkbox" value="12" name="vendor[]" id="17"><label for="17">12</label>
</li>
<li>
<input type="checkbox" value="13" name="vendor[]" id="24"><label for="24">13</label>
</li>
<li>
<input type="checkbox" value="14" name="vendor[]" id="19"><label for="19">14</label>
</li>
<li>
<input type="checkbox" value="15" name="vendor[]" id="18"><label for="18">15</label>
</li>
<li>
<input type="checkbox" value="16" name="vendor[]" id="1084"><label for="1084">16</label>
</li>
<li>
<input type="checkbox" value="17" name="vendor[]" id="22"><label for="22">17</label>
</li>
<li>
<input type="checkbox" value="18" name="vendor[]" id="12"><label for="12">18</label>
</li>
<div class="form-but-wrap">
<div class="form-but"><input type="submit" value="Фильтр"></div>
<div class="form-but"><input type="submit" onclick="filter_clear();" value="Сброс"></div>
<div class="clear"></div>
</div>
</ul></div>
</div>
<div class="row">
<div class="col-sm-12">
<ul class="multi-column-dropdown">
<div class="col-sm-4">
<li>
<input type="checkbox" value="1" name="vendor[]" id="21"><label for="21">1</label>
</li>
<li>
<input type="checkbox" value="2" name="vendor[]" id="23"><label for="23">2</label>
</li>
<li>
<input type="checkbox" value="3" name="vendor[]" id="13"><label for="13">3</label>
</li>
<li>
<input type="checkbox" value="4" name="vendor[]" id="26"><label for="26">4</label>
</li>
<li>
<input type="checkbox" value="5" name="vendor[]" id="27"><label for="27">5</label>
</li>
<li>
<input type="checkbox" value="6" name="vendor[]" id="28"><label for="28">6</label>
</li>
</div>
<div class="col-sm-4">
<li>
<input type="checkbox" value="7" name="vendor[]" id="29"><label for="29">7</label>
</li>
<li>
<input type="checkbox" value="8" name="vendor[]" id="16"><label for="16">8</label>
</li>
<li>
<input type="checkbox" value="9" name="vendor[]" id="25"><label for="25">9</label>
</li>
<li>
<input type="checkbox" value="10" name="vendor[]" id="20"><label for="20">10</label>
</li>
<li>
<input type="checkbox" value="11" name="vendor[]" id="14"><label for="14">11</label>
</li>
<li>
<input type="checkbox" value="12" name="vendor[]" id="17"><label for="17">12</label>
</li>
</div>
<div class="col-sm-4">
<li>
<input type="checkbox" value="13" name="vendor[]" id="24"><label for="24">13</label>
</li>
<li>
<input type="checkbox" value="14" name="vendor[]" id="19"><label for="19">14</label>
</li>
<li>
<input type="checkbox" value="15" name="vendor[]" id="18"><label for="18">15</label>
</li>
<li>
<input type="checkbox" value="16" name="vendor[]" id="1084"><label for="1084">16</label>
</li>
<li>
<input type="checkbox" value="17" name="vendor[]" id="22"><label for="22">17</label>
</li>
<li>
<input type="checkbox" value="18" name="vendor[]" id="12"><label for="12">18</label>
</li>
</div>
<div class="form-but-wrap">
<div class="form-but"><input type="submit" value="Фильтр"></div>
<div class="form-but"><input type="submit" onclick="filter_clear();" value="Сброс"></div>
<div class="clear"></div>
</div>
</ul></div>
</div>
Answer the question
In order to leave comments, you need to log in
Yes, at least divide without a remainder by N and if it divides, then print the desired separator
</div>
<div class="col-sm-4">
admin4web.ru/uslovie-kratnosti-trem-bitrix - use the multiplicity condition where, after the condition is triggered, insert the closing and opening of the div:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question