foreach($arResult["ITEMS"] as $key=>$arElement)
{
$id_pod = $arElement['ID'];
$arSelect = Array(/*"ID", "NAME", "DATE_ACTIVE_FROM",*/ "PRICE_MATRIX", "CATALOG_GROUP_8", "IBLOCK_ID");
$arFilter = Array("IBLOCK_ID"=>42, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "PROPERTY_CML2_LINK"=>array($id_pod));
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
while ($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
if ($arFields[CATALOG_QUANTITY] > 0)
{
$arResult['ITEMS'][$key]['PRICE'] = round($arFields['CATALOG_PRICE_8']);
break;
}
else
$arResult['ITEMS'][$key]['PRICE'] = false;
}
} |