Код |
---|
<? CModule::IncludeModule("iblock"); CModule::IncludeModule("sale"); CModule::IncludeModule("catalog"); $arSelect = Array("ID", "NAME", "DATE_ACTIVE_FROM", "CREATED_BY", "PROPERTY_*"); $arFilter = Array("IBLOCK_ID"=>6, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y"); $res = CIBlockElement::GetList(array(), $arFilter, false, Array("nPageSize"=>50), $arSelect); while($ob = $res->GetNextElement()) { $arFields = $ob->GetFields(); $arProps = $ob->GetProperties(); $arSelectCase = Array("ID", "NAME", "DATE_ACTIVE_FROM", "CREATED_BY", "PROPERTY_*"); $arFilterCase = Array("IBLOCK_ID"=>9, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "!=ID"=>$arProps["CASES"]["VALUE"]); $resCase = CIBlockElement::GetList(array(), $arFilterCase, false, Array("nPageSize"=>50), $arSelectCase); while($ob = $resCase->GetNextElement()) { $arFieldsCase = $ob->GetFields(); $arPropsCase = $ob->GetProperties(); echo $arFields["NAME"];?> <?=$arFieldsCase["ID"]?><?=$arFieldsCase["NAME"]?><br/> <?} }?> |
Код |
---|
<? CModule::IncludeModule("iblock"); CModule::IncludeModule("sale"); CModule::IncludeModule("catalog"); $arSelect = Array("ID", "NAME", "DATE_ACTIVE_FROM", "CREATED_BY", "PROPERTY_*"); $arFilter = Array("IBLOCK_ID"=>6, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y"); $i=0; $res = CIBlockElement::GetList(array(), $arFilter, false, Array("nPageSize"=>50), $arSelect); while($ob = $res->GetNextElement()) { $arFields = $ob->GetFields(); $arProps = $ob->GetProperties(); foreach ($arProps["CASES"]["VALUE"] as $case): $CASES[$i]=$case; $i++; endforeach; }?> <? echo "<pre>"; print_r(array_unique($CASES)); echo "</pre>";?> <? $CASES=array_unique($CASES); $arSelectCase = Array("ID", "NAME", "DATE_ACTIVE_FROM", "CREATED_BY", "PROPERTY_*"); $arFilterCase = Array("IBLOCK_ID"=>9, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "!=ID"=>$CASES); $resCase = CIBlockElement::GetList(array(), $arFilterCase, false, Array("nPageSize"=>50), $arSelectCase); while($ob = $resCase->GetNextElement()) { $arFieldsCase = $ob->GetFields(); $arPropsCase = $ob->GetProperties();?> <?=$arFieldsCase["ID"]?><?=$arFieldsCase["NAME"]?><br/> <?}?> |