Your IP : 3.147.44.255


Current Path : /home/bitrix/ext_www/dev.ballu.in.ua/yml/
Upload File :
Current File : /home/bitrix/ext_www/dev.ballu.in.ua/yml/yml.php

<?
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
$fd = fopen($_SERVER["DOCUMENT_ROOT"]."/exportxml/catalog.xml","w");
fwrite($fd,'<?xml version="1.0" encoding="UTF-8"?>');
fwrite($fd,'<yml_catalog date="'.date('h-i-s','g:i').'">');
fwrite($fd,'<shop>
				<name>ООО &amp;quot;Р-КЛИМАТ&amp;quot;</name>
				<company>ООО &amp;quot;Р-КЛИМАТ&amp;quot;</company>
				<url>https://www.ballu.ru/</url>
				<currencies>
					<currency id="RUR" rate="1"/>
				</currencies>');
fwrite($fd,"<categories>
	");

$arFilter = array('IBLOCK_ID' => 18, 'ACTIVE' => 'Y');
$rsSections = CIBlockSection::GetList(false, $arFilter);
while ($arSection = $rsSections->Fetch())
{
	fwrite($fd,'<category id="'.$arSection['ID'].'" parentId="'.$arSection['IBLOCK_SECTION_ID'].'">'.$arSection['NAME'].'</category>
		');
  
}


fwrite($fd,"</categories>
	");
fwrite($fd,'<delivery-options>
					<option cost="1000" days="35" order-before="18"/>
				</delivery-options>
				<offers>
				');

$arSelects = Array("ID", "NAME", "CODE");
$arFilters = Array("IBLOCK_ID"=>16, "ACTIVE"=>"Y");
$ress = CIBlockElement::GetList(Array(), $arFilters, false, false, $arSelects);
while($obs = $ress->GetNextElement())
{
 $arFieldss = $obs->GetFields();
 $props[] = $arFieldss;
}


$arSelect = Array("ID", "NAME", "PROPERTY_picture1_ru_new","DETAIL_PAGE_URL","IBLOCK_SECTION_ID", "PREVIEW_TEXT", "PROPERTY_");
$arFilter = Array("IBLOCK_ID"=>18, "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement())
{
 $arFields = $ob->GetFields();
 pre($arFields);
 $offer = ' ';
 $offer.= '<offer id="'.$arFields['ID'].'" >
 ';
 $offer.= '<url>https://www.ballu.ru'.$arFields['DETAIL_PAGE_URL'].'</url>
 ';
 if (CModule::IncludeModule("catalog"))
{
 $price = CPrice::GetByID($arFields['ID']);
 $db_res = CPrice::GetList(
        array(),
        array(
                "PRODUCT_ID" => $arFields['ID'],
            )
    );
if ($ar_res = $db_res->Fetch())
{
    $price = $ar_res["PRICE"];
}
}
 echo  $price;
 $offer.= '<price>'.$price.'</price>
 ';
 $offer.= '<currencyId>RUR</currencyId>
 ';
 $offer.= '<categoryId>'.$arFields['IBLOCK_SECTION_ID'].'</categoryId>
 ';
 $rsFile = CFile::GetPath($arFields['PROPERTY_PICTURE1_RU_NEW_VALUE']);
 echo  $rsFile;
 if (!empty($rsFile)) {
$offer.= '<picture>https://www.ballu.ru'.$rsFile.'</picture>
 ';
 }
 
 $offer.= '<vendor>BALLU</vendor>
 ';
 $arFields['PREVIEW_TEXT'] = str_replace("&nbsp", ' ', $arFields['PREVIEW_TEXT']);
  $arFields['PREVIEW_TEXT'] = str_replace("br", ' 
  	', $arFields['PREVIEW_TEXT']);
   $arFields['PREVIEW_TEXT'] = str_replace("<", ' ', $arFields['PREVIEW_TEXT']);
    $arFields['PREVIEW_TEXT'] = str_replace(">", ' ', $arFields['PREVIEW_TEXT']);
 $offer.= '<description>'.$arFields['PREVIEW_TEXT'].'</description>
 ';
 $offer.= '<name>'.$arFields['NAME'].'</name>
 ';

 //$offer.= '<offer id="'.$arFields['ID'].'" >
 //';

 $offer.= '<sales_notes>Оплата: Нал., безнал., Visa, MasterCard.</sales_notes>
 ';
 $offer.= '<manufacturer_warranty>true</manufacturer_warranty>
 </offer>
 ';
 if (!empty($price) && !empty($rsFile)) {
 	 fwrite($fd,$offer);
 }

}
 




fwrite($fd,"</offers>
	</shop>
			</yml_catalog>");	
fclose($fd);			
?>