E
E
Evgeny Nikolaev2020-02-13 14:22:38
1C-Bitrix
Evgeny Nikolaev, 2020-02-13 14:22:38

How to add an image (or several) to the multiple property of a Bitrix infoblock if it already has several images?

Let's say the infoblock has a multiple property for storing images with the PHOTO character code.

When I just need to add a new element with images, I do something like this:

$photoIBadd[] = array();

$el = new CIBlockElement;
$photoPropIBadd[] = CFile::MakeFileArray("http://и_так_далее_путь_до_изображения.jpg");
$photoPropIBadd[] = CFile::MakeFileArray("http://и_так_далее_путь_до_изображения_ещё_одного.jpg");

$arLoadProductArray = Array(
  "MODIFIED_BY"    => $USER->GetID(),
  "IBLOCK_SECTION_ID" => false,
  "IBLOCK_ID"      => 1,
  "NAME"           => $name,
  "ACTIVE"         => "Y",
  "CODE" => $code,
  "PROPERTY_VALUES" => array(
    "PHOTO"=>$photoPropIBadd
  )
);

$PRODUCT_ID = $el->Add($arLoadProductArray);


But if I need to add another image to the above PHOTO property by updating the infoblock, and leave the old ones, how can I do this? Is it necessary to transfer images that already exist again or can it be done without it, that is, by adding only a new one?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question