if (CModule::IncludeModule("iblock")) {
$arFilter = Array(
"IBLOCK_ID" => "4",
"PREVIEW_PICTURE" => false, // PREVIEW_PICTURE не задан
);
$arSelect = Array("IBLOCK_ID", "ID", "PREVIEW_PICTURE", "PROPERTY_artikul"); // и свойство "artikul" сразу
$arNavStartParams = Array(
"nPageSize" => 500,
"iNumPage" => 1, // первые 500
);
$dbE = CIBlockElement::GetList(Array("ID" => "ASC"), $arFilter, false, $arNavStartParams, $arSelect);
while ($arElement = $dbE->Fetch()) {
$el = new CIBlockElement;
$img = $arElement["PROPERTY_ARTIKUL_VALUE"];
$image = '/images/velo/700/' . $img . '.jpg';
$arLoadProductArray = Array(
"ACTIVE" => "Y", // активен
"DETAIL_PICTURE" => CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . $image)
);
$PRODUCT_ID = $arElement["ID"];
//ваш udpate
$res = $el->Update($PRODUCT_ID, $arLoadProductArray);
}
}
|