Your IP : 3.12.123.103
<?
//Andrey Ryzhuhin: создан по задаче № 116215
if (empty($_SERVER["DOCUMENT_ROOT"]))
$_SERVER["DOCUMENT_ROOT"] = "/home/bitrix/www";
if(empty($_SERVER['SERVER_NAME']))
$_SERVER['SERVER_NAME'] = "www.rusklimat.ru";
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
$fd = fopen($_SERVER["DOCUMENT_ROOT"]."/mb.yml","w");
fwrite($fd,'<?xml version="1.0" encoding="UTF-8"?>');
$date = date("Y-m-d H:i:s");
fwrite($fd,'
<yml_catalog date="'.$date.'">
<shop>
<name>easy-comfort.ru</name>
<company>easy-comfort.ru</company>
<url>http://www.easy-comfort.ru/</url>
<currencies>
<currency id="RUR" rate="1"/>
</currencies>
<categories>
');
$arSelect = array('ID','NAME' );
$rsParentSection = CIBlockSection::GetList(false, ["IBLOCK_ID" => 103], false, false, false);
while($ob = $rsParentSection->GetNextElement())
{
$arFields = $ob->GetFields();
if (!empty($arFields['IBLOCK_SECTION_ID']))
{
$parent = 'parentId="'. $arFields['IBLOCK_SECTION_ID'].'"';
}
fwrite($fd,'<category id="'.$arFields['ID'].'">'.$parent.'>'.$arFields['NAME'].'</category>
');
}
fwrite($fd,'</categories>
<offers>
');
$res = CIBlockElement::GetList(
Array(),
Array("IBLOCK_ID" => 103, "ACTIVE" => "Y"),
false,
false,
Array("ID","DETAIL_PAGE_URL","IBLOCK_SECTION_ID","NAME","PREVIEW_TEXT","PROPERTY_picture1_ru_new")
);
$arProps = array();
while ($ob = $res->GetNextElement())
{
$arFieldsprod = $ob->GetFields();
pre($arFieldsprod);
$db_res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $arFieldsprod['ID'],
)
);
if ($ar_res = $db_res->Fetch())
{
$price = CurrencyFormat($ar_res["PRICE"], $ar_res["CURRENCY"]);
}
$pict = CFile::GetPath($arFieldsprod['PROPERTY_PICTURE1_RU_NEW_VALUE']);
fwrite($fd,
'<offer id="'.$arFieldsprod['ID'].'" available="true">
<url>
http://www.easy-comfort.ru'.$arFieldsprod['DETAIL_PAGE_URL'].'
</url>
<price>'.$price.'</price>
<currencyId>RUB</currencyId>
<categoryId>'.$arFieldsprod['IBLOCK_SECTION_ID'].'</categoryId>
<name>
'.$arFieldsprod['NAME'].'
</name>
<description>
'.$arFieldsprod['PREVIEW_TEXT'].'
</description>
<picture>
http://www.easy-comfort.ru'.$pict.'
</picture>
</offer>
');
}
fwrite($fd,'</offers>
</shop>
</yml_catalog>
');
?>