Answer the question
In order to leave comments, you need to log in
Bitrix API - how to get the values of a multiple property of the file type for displaying images for a gallery?
The task is to create galleries on the site using the BITRIX API. Infoblock created with multiple type property - file "MORE_PHOTO" . Each image also has a description.
Using the CIBlockElement::GetList method , I get a list of infoblock elements, but I can't get the paths to files from the MORE_PHOTO multiple property, and I don't know how to describe them.
I'm trying to use:
<?php if(CModule::IncludeModule('iblock'))
{
$res = CIBlockElement::GetList(
array("SORT"=>"ASC"),
array("IBLOCK_ID"=>4,"ACTIVE"=>"Y"),
false,
false,
array("NAME","PREVIEW_TEXT", "PROPERTY_MORE_PHOTO")
);
while($arr = $res->GetNext())
{
$arrGalleries[] = $arr;
}
}
?>
[PROPERTY_MORE_PHOTO_VALUE] => 574
[~PROPERTY_MORE_PHOTO_VALUE] => 574
[PROPERTY_MORE_PHOTO_VALUE_ID] => 298
[~PROPERTY_MORE_PHOTO_VALUE_ID] => 298
Answer the question
In order to leave comments, you need to log in
$res = CIBlockElement::GetList(
array("SORT"=>"ASC"),
array("IBLOCK_ID"=>4,"ACTIVE"=>"Y"),
false,
false,
array("ID", "IBLOCK_ID")
);
while ($arr = $res->GetNextElement()) {
$fields = $arr->GetFields();
$arrGalleries[$fields['ID']] = $arr->GetProperty('MORE_PHOTO');
}
if(CModule::IncludeModule('iblock'))
{
$res = CIBlockElement::GetList(
array("SORT"=>"ASC"),
array("IBLOCK_ID"=>4,"ACTIVE"=>"Y"),
false,
false,
array("NAME","PREVIEW_TEXT", "PROPERTY_MORE_PHOTO")
);
while($arr = $res->GetNext())
{
$arr['PROPERTY_MORE_PHOTO_VALUE'] = \CFile::GetFileArray($arr['PROPERTY_MORE_PHOTO_VALUE']);
$arrGalleries[] = $arr;
}
}
$arr['PROPERTY_MORE_PHOTO_VALUE'] = \CFile::GetFileArray($arr['PROPERTY_MORE_PHOTO_VALUE']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question