Last active
October 31, 2018 05:15
-
-
Save maxsbelt/5524272 to your computer and use it in GitHub Desktop.
BITRIX: Заметка по CIBlockElement::SetPropertyValues()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// тип: Строка / (множ) строка | |
$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