Your IP : 13.59.104.84


Current Path : /home/bitrix/ext_www/ballu.in.ua/import/subscripts/
Upload File :
Current File : /home/bitrix/ext_www/ballu.in.ua/import/subscripts/gate_price_load.php

<pre><?$_SERVER["DOCUMENT_ROOT"] = __DIR__."/../..";

require $_SERVER["DOCUMENT_ROOT"]."/import/.config.php";
	
	$method = "price";
	//echo "hi";
	startTimer("price");
	$arRes = getRest("price");
	stopTimer("price");

	$prices = arFormatPrices($arRes["data"]);
	/*
	"data": [
		{
			"DataStart": "2017-06-15T01:01:00",
			"Goods_ID": "4cd4273b-c03e-4966-8003-395120240b25",
			"PriceBush_ID": "63428995-7678-11e6-9430-9cb654954508",
			"Price": "5790",
			"FIX": "false",
			"PriceOLD": "0",
			"DataEnd": "0001-01-01T00:00:00"
		},
		*/
	
	startTimer("els");
	$arElements = allElements($IBLOCK, ["ID","NAME","XML_ID"],"XML_ID");
	$arElements = cleanTilda($arElements);
	stopTimer("els");
//echol($prices);
	startTimer("remake");
	foreach($arElements as $id => $el){
		if(!empty($prices[$id])){
			$El = $el;
			// price = $el[]
			foreach($prices[$id] as $bush => $arPr){
				$El["PRICE"][$bush]=$arPr["norm"];
				$El["PRICE"][$bush."_NODISCOUNT"]=$arPr["old"];

			}
			//$out[$rl["ID"]]["PRICE"]=array(=>)
			//$El["price"] = $prices[$id];
			$out[$el["ID"]] = $El;
		} 
		//$arElements[$id]

	}

//echol($out);

	stopTimer("remake");
	$priceConfig = getPriceTypes();
	echol($priceConfig);
	startTimer("load");
	foreach($out as $id => $el){
		setBasePrice($id, $el["PRICE"]);
	}
	stopTimer("load");
	print_r($out[2436]);
	print_r($out[3796]);


	outTimers();




$fd = fopen($_SERVER["DOCUMENT_ROOT"]."/import/my_cron.txt","a"); 
fwrite($fd, "Обращение к gate_price_load - ".date("d.m.Y H:i")."\r\n"); 
fclose($fd);

	//echo(count($arRes));

?></pre>