B
B
BLOOD_ELF2018-07-13 11:04:14
1C-Bitrix
BLOOD_ELF, 2018-07-13 11:04:14

How to display data from a custom field in Bitrix?

Hello. In the online store in the list of retail stores (warehouses) I want to add additional photos. I made a custom field UF_STOREPHOTO of the file type, the picture is loaded. But I ran into a problem with displaying this field on the page. I'm editing catalog.store.detail, but I can't get the data out of the custom field. Looked for various solutions, but none worked.
I also tried to make a new IMAGE_ID2 column directly in the database, by analogy with the existing IMAGE_ID, but it is also not picked up, although the standard IMAGE_ID works. As if you still need to manually specify that there is such an IMAGE_ID2 field in the database.
For example, I tried this:

<?
$rsResult = CIBlockSection::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => $arItems["IBLOCK_ID"], "ID" => $arItems["ID"]), false, $arSelect = array("UF_*"));
if($arSection = $rsResult->GetNext()) { 
$UF_STOREPHOTO = $arSection["UF_STOREPHOTO"];
}
?>

But it doesn't work.
<img src="<?=CFile::GetPath($UF_STOREPHOTO);?>" alt="" />

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Komarnitsky, 2018-07-13
@romkom

Custom properties are stored in an array.

<?foreach($arResult as $arItem) { 
    echo '<pre>';
    print_r($arItem["PARAMS"]);
    echo '</pre>';
}
?>

Look for it in the output, if it is, then output it through the same foreach:
<?
echo $arItem['PARAMS']["Название пользовательского свойства"]
?>

B
BLOOD_ELF, 2018-07-13
@BLOOD_ELF

Something didn't work out. print_r outputs a lot of numbers and letters, among them there is no ID of the property I need. Maybe the fact is that Warehouses is not an infoblock available for direct editing, like the same products, news, videos, and so on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question