IsAdmin()) { echo "

Need Admin

-login-"; die(); } ini_set('display_errors',1); ini_set("error_reporting", E_ERROR); if (empty($_GET)) { ?>

SKU IBlock ID 3

SKU IBlock ID 6

ID section



0) { $res = CIBlockSection::GetByID($sectID); if($ar_res = $res->GetNext()) { ?>
section ID:
section NAME:
процент:


\n"; $intProductIBlock = $arCatalog['PRODUCT_IBLOCK_ID']; // ID IBlock goods $intSKUProperty = $arCatalog['SKU_PROPERTY_ID']; // ID prop (SKU) $obElement = new CIBlockElement(); $arSelect1 = Array("ID", "IBLOCK_ID", "NAME"); if($sectID>0) { $arFilter1 = Array("IBLOCK_ID"=>$intProductIBlock, "SECTION_ID"=>$sectID, "INCLUDE_SUBSECTIONS" => "Y",); } else { $arFilter1 = Array("IBLOCK_ID"=>$intProductIBlock); } $rsEl1 = CIBlockElement::GetList(Array(), $arFilter1, false, false, $arSelect1); while($ob1 = $rsEl1->GetNextElement()) { if (file_exists('stop.txt')) die('stop'); $obFields1 = $ob1->GetFields(); $intProductID = $obFields1["ID"]; $PRODUCT_ID = $intProductID; $name = $obFields1["NAME"]; echo "intProductID $intProductID $name"; $arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM", "PROPERTY_*");//IBLOCK_ID и ID - REQUIRED!!! $arFilter = Array("IBLOCK_ID"=>$intSKUProperty, "PROPERTY_CML2_LINK"=>$PRODUCT_ID); $rsEl = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect); $off=0; while($ob = $rsEl->GetNextElement()) { if (file_exists('stop.txt')) die('stop'); $off=1; $obFields = $ob->GetFields(); $intOfferID = $obFields["ID"]; $obProps = $ob->GetProperties(); $res = CPrice::GetBasePrice($intOfferID); $price = $res[PRICE] + $res[PRICE]*$proc/100; $price = round($price/10)*10; echo "New price OFFER $intOfferID $res[PRICE] => $price"; CPrice::SetBasePrice($intOfferID, $price, 'RUB'); } if($off==0) { $res = CPrice::GetBasePrice($intProductID); $price = $res[PRICE] + $res[PRICE]*$proc/100; $price = round($price/10)*10; echo "New price CATALOG $res[PRICE] => $price"; CPrice::SetBasePrice($intProductID, $price, 'RUB'); } } echo "done"; ?>