Skip to content

Instantly share code, notes, and snippets.

@maxsbelt
Last active October 31, 2018 05:15
Show Gist options
  • Save maxsbelt/5524272 to your computer and use it in GitHub Desktop.
Save maxsbelt/5524272 to your computer and use it in GitHub Desktop.
BITRIX: Заметка по CIBlockElement::SetPropertyValues()
<?
// тип: Строка / (множ) строка
$arPropertyValues = array(
"STRING" => "some string",
"STRING_MULTIPLE" => array(
"first row",
"second row",
"third row"
)
);
// тип: число / (множ) число
// hint: для чисел с плавающей точкой разделитель '.'
$arPropertyValues = array(
"NUMBER" => -46.001,
"NUMBER_MULTIPLE" => array(
"1",
12,
"-148.001"
)
);
// тип: список / (множ) список
// >>> для получения ID свойства по XML_ID:
$arFilter = array(
"IBLOCK_ID" => 3,
"CODE" => "LIST_MULTIPLE",
"XML_ID" => "MAYBE"
);
$rsEnum = CIBlockPropertyEnum::GetList(false, $arFilter);
if ($arEnum = $rsEnum->Fetch())
{
$ID = $arEnum['ID'];
}
// <<<
$arPropertyValues = array(
"LIST" => array(
"VALUE" => $ID
),
"LIST_MULTIPLE" => array(
array(
"VALUE" => 7
),
array(
"VALUE" => 9
)
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment