выгрузки 1с
AddEventHandler("catalog", "OnPriceUpdate", "HandlerOnPriceUpdate");function HandlerOnPriceUpdate($ID,&$arFields){Cmodule::IncludeModule('iblock');Cmodule::IncludeModule('catalog');$iblockId = 4;$updateElements = CIBlockElement::GetList( Array("ID" => "ASC"), Array("IBLOCK_ID" => $iblockId), false, false, Array( 'ID', 'KOMPLEKTATSIYA_PERVICHNAYA_UPAKOVKA' ));while ($arFields = $updateElements->GetNext()) { $coeff = $arFields['KOMPLEKTATSIYA_PERVICHNAYA_UPAKOVKA']; $str = preg_replace("/[^0-9]/", '', $coeff); $delenie = $arResult['CATALOG_QUANTITY']; $finish = (int)($delenie / $str); $curElementRatio = CCatalogMeasureRatio::getList( Array(), array('IBLOCK_ID' => $iblockId, 'PRODUCT_ID' => $arFields['ID']), false, false); while ($arRatio = $curElementRatio->GetNext()) { $ratioId = $arRatio['ID']; } CCatalogMeasureRatio::update($ratioId, Array( 'PRODUCT_ID' => $arFields['ID'], 'RATIO' => $finish) );}}
В нечитаемости сообщения
Обсуждают сегодня