Answer the question
In order to leave comments, you need to log in
How to enter data into the List property via Bitrix API 1-C?
Hello!
How to add data to an ifnoblock that has a property of type List with the value:
XML_ID: Y
Value: Yes
$empty_field = "N";
$filled_field = "Да";
// $filled_field = "Y";
!empty($_POST['girl']) ? $girl = $filled_field : $girl = $empty_field;
!empty($_POST['boy']) ? $boy = $filled_field : $boy = $empty_field;
!empty($_POST['gab']) ? $gab = $filled_field : $gab = $empty_field;
CModule::IncludeModule('iblock');
$el = new CIBlockElement;
$iblock_id = 17;
$section_id = false;
$PROP = array();
$PROP['ATT_SUBS_GIRL'] = $girl;
$PROP['ATT_SUBS_BOY'] = $boy;
$PROP['ATT_SUBS_GAB'] = $gab;
$fields = array(
"DATE_CREATE" => date("d.m.Y H:i:s"),
"CREATED_BY" => $GLOBALS['USER']->GetID(),
"IBLOCK_SECTION" => false,
"IBLOCK_ID" => $iblock_id,
"PROPERTY_VALUES" => $PROP,
"NAME" => date("d.m.Y H:i:s"),
"ACTIVE" => "Y"
);
if ( ! $el->Add($fields) ) {
$result = false;
}
Answer the question
In order to leave comments, you need to log in
As a property value of the "List" type, it must be passed to XML_ID, and ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question