Answer the question
In order to leave comments, you need to log in
Is it possible to add multiple items with one request?
I loop through the elements and in each iteration I call Ciblockelement::add .
Is it possible to add multiple items with one request? No cycle.
Answer the question
In order to leave comments, you need to log in
Why do you think CIblockElement::add adds an element in one request? After all, it does not just insert a line into b_iblock_element, but also performs many other auxiliary functions.
For example: you can specify DETAIL_* and PREVIEW_* images (and these are entries in b_file), they can have descriptions from SEO modules (and for this, the SEO part must know about the formation rules and entity fields). They have events (for example, OnIBlockElementAdd, etc.) that can prevent one element from being changed or change its data. And there are also business processes that can be launched.
In theory, it is possible to add records in one request, but in this case you lose 60-75% of the system's capabilities (in fact, you just fill in the usual standard element string fields). Perhaps the d7 approach and the appearance of objects can somehow affect this, but at the moment there is no such mechanism.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question