Answer the question
In order to leave comments, you need to log in
How to break uploading from JSON into steps?
There is a JSON with 4500 products with characteristics.
Through CIBlockElement::Add I bypass the array and create a product. The problem is that a 504 error is thrown.
I tried to increase the server response time - it didn’t help.
At the same time, the goods were created in the end, but now you need to update their prices, taking them from JSON, when bypassing, 504 is also issued
//$items - json
foreach ($items as $key => $item) {
$arSelect = Array("ID", "PROPERTY_CML2_ARTICLE");
$arFilter = Array("IBLOCK_ID"=>32, "PROPERTY_CML2_ARTICLE"=> $item['код_артикула']);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($itemUpdate = $res->GetNext())
{
CPrice::SetBasePrice($itemUpdate['ID'], $item['цена'], 'RUB');
unset($items[$key]);
}
}
Answer the question
In order to leave comments, you need to log in
You can use the special Bitrix ui.stepprocessing for step-by-step scripts.
https://dev.1c-bitrix.ru/api_d7/bitrix/ui/stepproc...
https://dev.1c-bitrix.ru/api_d7/bitrix/ui/stepproc...
This is for the front. On the backend, you need to write a script that will process elements with the specified offset. And the answer must be in the format that is described in the documentation for this library.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question