Подскажите как можна убрать товары с
IN_STOCK - noи второй момент вывести где красное
public function yandex($absPathToXmlFile)
{
Loader::includeModule('iblock');
$this->absPathToXmlFile = $absPathToXmlFile;
$arr = array(
'yml_catalog' => array(
'shop' => array(
'name' => iconv('windows-1251', 'utf-8', $this->siteName),
'company' => iconv('windows-1251', 'utf-8', $this->siteName),
'url' => "http://".SITE_SERVER_NAME."/",
'currencies' => array(
'currency' => array(
'@attributes' => array(
'id' => 'RUB',
'rate' => '1'
),
),
),
'categories' => array(),
'offers' => array(),
)
)
);
$arSections = array();
$dbSections = $this->getSectionsCDBResult();
while ($arSection = $dbSections->GetNext())
{
if ($arSection['PARENT_SECTION_ID'] > 0)
{
$arr['yml_catalog']['categories']['category'][] = array(
'@value' => iconv('windows-1251', 'utf-8', $arSection['NAME']),
'@attributes' => array(
'id' => $arSection['ID'],
'parentId' => $arSection['PARENT_SECTION_ID']
),
);
}
else
{
$arr['yml_catalog']['categories']['category'][] = array(
'@value' => iconv('windows-1251', 'utf-8', $arSection['NAME']),
'@attributes' => array(
'id' => $arSection['ID'],
),
);
}
}
$dbProducts = $this->getElementsCDBResult();
while ($arProduct = $dbProducts->GetNext())
{
if ($arProduct['IBLOCK_SECTION_ID'] == '135' || empty($arProduct['DETAIL_PAGE_URL']))
continue;
if (empty($arProduct['DETAIL_TEXT']))
$arProduct['DETAIL_TEXT'] = CDev::getProductDescriptionByProps($arProduct['ID'], $arProduct['IBLOCK_ID']);
$arProduct['DETAIL_PICTURE_INFO'] = CFile::GetFileArray($arProduct['DETAIL_PICTURE']);
if ($arProduct['DETAIL_PICTURE_INFO']['WIDTH'] < 600 || $arProduct['DETAIL_PICTURE_INFO']['HEIGHT'] < 600)
{
}
if (empty($arProduct['PROOPERTY_GTIN_VALUE']))
{
$newGTIN = $arProduct['PROOPERTY_GTIN_VALUE'] = randString(13, '0123456789');
CIBlockElement::SetPropertyValuesEx($arProduct['ID'], $arProduct['IBLOCK_ID'], array('GTIN' => $newGTIN));
}
$arProduct['DETAIL_PAGE_URL'] = "http://".SITE_SERVER_NAME.$arProduct['DETAIL_PAGE_URL'];
$arOffers[] = $arProduct;
$arr['yml_catalog']['offers']['offer'][] = array(
'@attributes' => array(
'id' => $arProduct['ID'],
'available' => 'true',
),
'url' => $arProduct['DETAIL_PAGE_URL'],
'price' => $arProduct['CATALOG_PRICE_1'],
'currencyId' => 'RUB',
'categoryId' => $arProduct['IBLOCK_SECTION_ID'],
'name' => iconv('windows-1251', 'utf-8', $arProduct['NAME']),
'model' => iconv('windows-1251', 'utf-8', $arProduct['NAME']),
'picture' => "http://".SITE_SERVER_NAME."".CFile::GetPath($arProduct['DETAIL_PICTURE']),
'vendor' => iconv('windows-1251', 'utf-8', $arProduct['PROPERTY_VENDOR_NAME']),
'vendorCode' => $arProduct['PROPERTY_GTIN_VALUE'],
'store' => $arProduct['IN_STOCK'],
'description' => iconv('windows-1251', 'utf-8', $arProduct['DETAIL_TEXT']),
);
}
$this->putResultInXmlFile($arr);
}вЃ