Cmodule::IncludeModule('catalog');
$el = new CIBlockElement;
if (!empty($arElement["PROPERTIES"]["NOT_FOR_SALE"]["VALUE"])) {
$arFields = array("QUANTITY" => 0, "CAN_BUY_ZERO"=> "N");
CCatalogProduct::Update($ID, $arFields);
} else {
$arFields = array("CAN_BUY_ZERO"=> "D");
CCatalogProduct::Update($ID, $arFields);
}
$rsOffers = CIBlockElement::GetList(
array("sort" => "ASC"), array('ID' => $tpred["ID"]),false,false,
array("ID", "IBLOCK_ID", "CATALOG_PRICE_1", "NAME","ACTIVE","PROPERTY_SIZE_IMG_SIGN","PROPERTY_MINIMUM_PRICE"));
.........
while($arElement = $rsOffers->GetNextElement()){
$arFields = $arElement->GetFields();
.........
echo $price = round($arFields['CATALOG_PRICE_1']);
.........
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
CModule::IncludeModule("iblock");
$arFields[0] = Array(
"NAME" => 'Название',
"ACTIVE" => "Y",
"SORT" => "500",
"CODE" => "CODE",
"PROPERTY_TYPE" => "N", // тип смотри внизу описания
"IBLOCK_ID" => $IBLOCK_ID
);
$ibp = new CIBlockProperty;
if($PropID = $ibp->Add($arFields[0])) {echo 'OK: '.$PropID;}
else {echo 'Error: '.$ibp->LAST_ERROR;};
Приходится еще один договор составлять, прописывать новые.
<?
require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
CModule::IncludeModule("iblock");
$dom = new domDocument("1.0", 'utf-8');
$xml = $dom->createElement("xml");
$xml ->setAttributeNS(null, 'version', '1.0');
$xml ->setAttributeNS(null, 'encoding', 'utf-8');
$dom->appendChild($xml);
$urlset = $dom->createElement("urlset");
$urlset->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$urlset->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:image','http://www.google.com/schemas/sitemap-image/1.1');
$arSelect = Array("ID", "NAME", "DETAIL_PAGE_URL", "PREVIEW_PICTURE");
$arFilter = Array("IBLOCK_ID"=>8, "SECTION_ID"=>100, "INCLUDE_SUBSECTIONS" => "Y"); //ID Инфоблока и ID раздела с элементами
$rsElement = CIBlockElement::GetList(Array("NAME" => "ASC"), $arFilter, false, Array("nPageSize"=>5), $arSelect);
$arResult["ITEMS"] = array();
while($obElement = $rsElement->GetNextElement())
{
$arItem = $obElement->GetFields();
$arItem["PROPERTIES"] = $obElement->GetProperties();
$google_link = 'https://site.ru'.$arItem[DETAIL_PAGE_URL];
$google_img = 'https://site.ru'.CFile::GetPath($arItem[PREVIEW_PICTURE]);
$url = $dom->createElement("url");
$login = $dom->createElement("loc", $google_link);
$url->appendChild($login);
$image = $dom->createElement("image:image");
$image2 = $dom->createElement("image:loc", $google_img);
$image->appendChild($image2);
$url->appendChild($image);
$urlset->appendChild($url);
};
$xml->appendChild($urlset);
$dom->save("img.xml"); //в корне директории откуда запускаем скрипт
echo 'Готово';
?>
214 дней
есть свойство БРЕНД
фильтровать выдачу
"SEF_URL_TEMPLATES" => array(
"sections" => "",
"section" => "#SECTION_CODE_PATH#/",
"element" => "#SECTION_CODE_PATH#/#ELEMENT_CODE#/",
"smart_filter" => "#SECTION_CODE_PATH#/filter/#SMART_FILTER_PATH#/",
),
if (isset($iOstatok)) {
if ($iOstatok > 0) {
$el = new CIBlockElement;
/*активировать, если деактивирована*/
if ($ar_res["ACTIVE"] == "N") {
/*активировать*/
$arLoadProductArray = Array(
"IBLOCK_SECTION_ID" => false,
"IBLOCK_ID" => $iBlock,
"ACTIVE" => "Y"
);
$el->Update($iElementID, $arLoadProductArray);
}
Cmodule::IncludeModule('catalog');
$arFields = array("QUANTITY" => $iOstatok);
CCatalogProduct::Update($iElementID, $arFields);
//$el->SetPropertyValues($iElementID, $iBlock, $iOstatok, "QUANTITY");
/*обновление остатков*/
} else {
/*обновление остатков*/
Cmodule::IncludeModule('catalog');
$el = new CIBlockElement;
$arFields = array("QUANTITY" => $iOstatok);
CCatalogProduct::Update($iElementID, $arFields);
}
}