Skip to content

Instantly share code, notes, and snippets.

@marat-dimaev
Created August 7, 2016 20:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marat-dimaev/e7ff5e4ffe0c09260870852cff00c8ed to your computer and use it in GitHub Desktop.
Save marat-dimaev/e7ff5e4ffe0c09260870852cff00c8ed to your computer and use it in GitHub Desktop.
Bitrix вывод значений свойств элемента инфоблока
\Bitrix\Main\Loader::includeModule('iblock');
$res = \CIBlockElement::GetList(
array(),
array('ID'=>$id,'ACTIVE'=>'Y','IBLOCK_ID'=>self::$IBLOCK_ID),
false,
array('nTopCount'=>1),
array("ID", "IBLOCK_ID", 'NAME','PREVIEW_PICTURE','DETAIL_PICTURE','PREVIEW_TEXT','PROPERTY_*')
);
if($res->SelectedRowsCount()) {
$ob = $res->GetNextElement();
$fields = $ob->GetFields();
$props = $ob->GetProperties();
foreach ($props as $key => $prop) {
$props[$key] = \CIBlockFormatProperties::GetDisplayValue($fields,$prop,'films');
}
$fields['PROPS'] = $props;
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment