I
I
I'm Yoda2018-04-18 22:38:53
1C-Bitrix
I'm Yoda, 2018-04-18 22:38:53

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

1 answer(s)
A
Anton, 2018-04-19
@Anadi

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;
 ?>

In your case, you need to update not the Property property, but the "SORT" => "ASC" field,
you can get the id list for the array via getlist
In general, there was a module on the market that was paid with a test period of 7 days. This is enough to complete your task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question