A
A
Alexander2018-11-16 17:08:36
1C-Bitrix
Alexander, 2018-11-16 17:08:36

How to update DESCRIPTION of multiple file type property?

I need to update the DESCRIPTION field of the multiple file property. How to do it?
I read this:
https://dev.1c-bitrix.ru/support/forum/forum6/topi...
dev.1c-bitrix.ru/support/forum/forum6/topic34230
https://dev.1c-bitrix .ru/learning/course/index.php...
https://dev.1c-bitrix.ru/api_help/iblock/classes/c...
and couldn't find an answer anywhere.
If I use SetPropertyValueCode or SetPropertyValuesEx and only pass array('DESCRIPTION' => $desc); then nothing happens.
If I do this - Array("VALUE"=>$arFile,"DESCRIPTION"=>$desc), then SetPropertyValuesEx simply overwrites the properties, no matter what I pass in VALUE - whether it is an array obtained using GetFileArray or a file ID. I don't want to make an array from the file path using MakeFileArray, because in this case the file will be re-registered and re-saved again (am I right?) and I will get zombie files.
SetPropertyValueCode just doesn't do anything unless I set the keys as Id values ​​as stated in the documentation.
How to update DESCRIPTION without updating the file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-11-16
Madzhugin @Suntechnic

if ($arObject['PROPERTY_PHOTO_DESCRIPTION'][$k] != $desc) CIBlockElement::SetPropertyValueCode(
                    $arObject['ID'],
                    'PHOTO',
                    Array($arObject['PROPERTY_PHOTO_PROPERTY_VALUE_ID'][$k] => Array("DESCRIPTION"=>$desc))
                );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question