Answer the question
In order to leave comments, you need to log in
What event to use when quickly editing an element?
Hi all!
I'm trying to batch update the "SORT" field. At the moment I'm using the OnAfterIBlockElementUpdate event , everything works, but it's not convenient that you need to go into each element. How to correctly implement a batch change of the "SORT" field?
Select 10 elements, click "Edit" and just save. How to be? Where to dig?
Answer the question
In order to leave comments, you need to log in
Do you need to bulk update the fields of the elements?
It is not clear why to use (and how they managed) the OnAfterIBlockElementUpdate event
-- Here is an example of how to massively
update only one property, without overwriting others, with one request (code execution, i.e. one page update)
<?
$ELEMENT_ID = array( 2, 3, 600, 543, 343, 34, 666, 23);
$PROPERTY_CODE = "PROP1" ; // код свойства
$PROPERTY_VALUE = "Синий" ; // значение свойства
foreach($ELEMENT_ID as $kel):
// Установим новое значение для данного свойства данного элемента
CIBlockElement::SetPropertyValuesEx( $kel , false , array ( $PROPERTY_CODE => $PROPERTY_VALUE ));
endforeach;
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question