M
M
margaret_murka2021-09-02 09:01:54
1C-Bitrix
margaret_murka, 2021-09-02 09:01:54

How to change the property value of the Bitrix information block element?

Unable to change the property value of the information block element.
// the property is called moderation (there are 3 values) The
beginner did not fully understand the classes and methods, and the documentation does not help, because I did not catch something important
through Update, writes ..Call to undefined method _CIBElement: :Update()
via SetPropertyValuesEx

$res = CIBlockElement::GetList(array('id' => 'desc'), $arFilter, false, array("nPageSize" => 10), array());
?>

<form class="myform" action="" method="POST" id="moderation_form" enctype="multipart/form-data">

  <?
  while ($ads = $res->GetNextElement()) {
    $arFields = $ads->GetFields(); // Поля
    $arParams = $ads->GetProperties(); // Свойства
    if(!$arParams['moderation']['VALUE_ENUM_ID']){
      $re = $ads->SetPropertyValuesEx($arParams["ID"], array('VALUE_ENUM_ID' => 1052)); //
    }

A small piece of code, I don’t suppose that it may be necessary to understand the situation, I’m sorry I suppose
the problem is that there is no understanding ... the difference between classes and methods in general, if there is something to read, I will be very grateful, but not the documentation, it does not help

maybe the advice will be on more adequate writing of the code, now a separate variable for fields, a separate one for properties, while GetList is used first ...
well, I really need help ;(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aricus, 2021-09-02
@margaret_murka

SetPropertyValuesEx

CIBlockElement::SetPropertyValuesEx(
int ELEMENT_ID,
int IBLOCK_ID,
array PROPERTY_VALUES,
array FLAGS = array()
);

As I understand it, you missed the infoblock id. Plus, it's a static method. See the example at the link.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question