Обновляем название торговых предложений из названия товара.
<?// get items
$arItemsSKU = array();
$arOrder = array('SORT' => 'ASC');
$arSelect = Array("ID", "NAME", "IBLOCK_SECTION_ID", "PROPERTY_RAZMER");
$arFilter = Array("IBLOCK_ID" => CATALOG_SKU);
$res = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect);
while ($ob = $res->GetNext()) {
$arItemsSKU[] = $ob;
unset($ob);
}
foreach ($arItemsSKU as $i=>$item) {
$newName = "";
$mxResult = CCatalogSku::GetProductInfo(
$item["ID"]
);
if (is_array($mxResult))
{
// add root name
$res = CIBlockElement::GetByID($mxResult["ID"]);
if($ar_res = $res->GetNext()){
$newName .= $ar_res["NAME"] . " ";
//pr($newName);
}
// add size
$newName .= $item["PROPERTY_RAZMER_VALUE"];
$el = new CIBlockElement;
$arLoadProductArray = Array(
"NAME" => $newName
);
$res = $el->Update($item["ID"], $arLoadProductArray);
}
}
?>