Answer the question
In order to leave comments, you need to log in
Bitrix API, how can I get the value of infoblock element properties in D7?
Tell me how, using the D7 core API, you can get the value of the properties of an infoblock element and make a selection of infoblock elements by properties?
There is an infoblock News, its elements have the PROPERTY_SPORT_TYPE property, this property is a link to the infoblock element Sports. For example, there are 5 football news and I have to get them.
Using the old API, I get a list of news for a specific sport using a filter like this:
$arFilter = array("IBLOCK_ID"=>$iblock_id, "ACTIVE_FROM","=PROPERTY_SPORT_TYPE"=>$sport_type_id);
$arSelect = array("ID", "NAME", "DETAIL_PAGE_URL", "ACTIVE_FROM", "CODE", "PROPERTY_*");
$arFilter = array("IBLOCK_ID"=>$iblock_id, "ACTIVE_FROM","=PROPERTY_SPORT_TYPE"=>$sport_type_id);
$arItems = [];
$res = CIBlockElement::GetList(array(), $arFilter, false, array("nPageSize"=>500), $arSelect);
while($arItem = $res->fetch()){
$dbProperty = CIBlockElement::getProperty($arItem['IBLOCK_ID'], $arItem['ID'], array("sort", "asc"),array());
while ($arProperty = $dbProperty->GetNext()) {
if($arProperty['CODE'] == 'SPORT_TYPE'){
$arItem['SPORT_TYPE'][] = $arProperty['VALUE'];
}
}
}
Answer the question
In order to leave comments, you need to log in
https://qna.habr.com/q/828871 - it was a D7 bug, they fixed it in kernel 20.200
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question