Created
October 15, 2019 15:05
-
-
Save Dziuperman/fef3ebc3b5a8257f1bb25990ded32850 to your computer and use it in GitHub Desktop.
Каталог из разделов #bitrix #bitrix:catalog.section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/*** | |
Получаем массив коллекций, отфильтрованных умным фильтром. | |
Сравниваются массивы чекнутых свойств фильтра и свойства | |
всех товаров | |
***/ | |
/*** Start Массив отфильтрованных коллекций ***/ | |
if (CModule::IncludeModule("iblock")) { | |
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "PROPERTY_231", "PROPERTY_232"); | |
$arFilter = Array("IBLOCK_ID" => 17, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y"); | |
$res = CIBlockElement::GetList( | |
Array("NAME" => "ASC"), $arFilter, false, Array("nPageSize" => 99999), $arSelect | |
); | |
// Получаем массив коллекций для фильтра | |
$altoCollectionsName = Array(); | |
} | |
//echo "<table id=\"mid\" border = 1>"; | |
//vardump($GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_232"]); | |
while ($ob = $res->GetNextElement()) { | |
// echo "<tr><td>"; | |
// echo "<td>"; | |
$arFields = $ob->GetFields(); | |
// echo "</td>"; | |
// echo "<td>"; | |
$arProps = $ob->GetProperties(); | |
// print_r($arProps["COLOR"]["VALUE"]); | |
// echo "</td>"; | |
// echo "</tr></td>"; | |
?> | |
<? if (($GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_232"] && !$GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_231"]) && in_array($arFields["PROPERTY_232_ENUM_ID"], $GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_232"])): ?> | |
<? | |
$elem = CIBlockElement::GetByID($arFields["ID"]); | |
if ($arElem = $elem->Fetch()) { | |
print_r($arElem["IBLOCK_SECTION_ID"]); | |
$elem = CIBlockSection::GetByID($arElem["IBLOCK_SECTION_ID"]); | |
if ($arElem = $elem->Fetch()) { | |
$altoCollection = $arElem["ID"]; | |
$altoCollectionsName[] = $altoCollection; | |
} | |
} | |
?> | |
<? elseif (($GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_231"] && $GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_232"]) && (in_array($arFields["PROPERTY_231_ENUM_ID"], $GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_231"]) && in_array($arFields["PROPERTY_232_ENUM_ID"], $GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_232"]))): ?> | |
<? | |
$elem = CIBlockElement::GetByID($arFields["ID"]); | |
if ($arElem = $elem->Fetch()) { | |
print_r($arElem["IBLOCK_SECTION_ID"]); | |
$elem = CIBlockSection::GetByID($arElem["IBLOCK_SECTION_ID"]); | |
if ($arElem = $elem->Fetch()) { | |
$altoCollection = $arElem["ID"]; | |
$altoCollectionsName[] = $altoCollection; | |
} | |
} | |
?> | |
<? elseif (($GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_231"] && !$GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_232"]) && in_array($arFields["PROPERTY_231_ENUM_ID"], $GLOBALS[$arParams["FILTER_NAME"]]["=PROPERTY_231"])): ?> | |
<? | |
$elem = CIBlockElement::GetByID($arFields["ID"]); | |
if ($arElem = $elem->Fetch()) { | |
print_r($arElem["IBLOCK_SECTION_ID"]); | |
$elem = CIBlockSection::GetByID($arElem["IBLOCK_SECTION_ID"]); | |
if ($arElem = $elem->Fetch()) { | |
$altoCollection = $arElem["ID"]; | |
$altoCollectionsName[] = $altoCollection; | |
} | |
} | |
?> | |
<? else: ?> | |
<? endif; ?> | |
<? } ?> | |
<?// if($altoCollectionsName && $altoCollectionsName != '') { | |
$altoCollectionsName = array_unique($altoCollectionsName); | |
//} else { | |
// $altoCollectionsName = false; | |
//} | |
?> | |
<?// vardump($altoCollectionsName); ?> | |
<?// echo "</table>"; | |
?> | |
<? | |
global $ALTO_COLLECTIONS; | |
$ALTO_COLLECTIONS = $altoCollectionsName; | |
/*** End Массив отфильтрованных коллекций ***/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment