Answer the question
In order to leave comments, you need to log in
Is the value of the property set to the IB element in the loop?
I create a property YES/NO, and set the value of this property of a certain section of goods in a cycle.
$arFields = Array(
"NAME" => "Export to VK",
"ACTIVE" => "Y",
"SORT" => "600",
"CODE" => "Export",
"PROPERTY_TYPE" => "L ",
'LIST_TYPE' => 'C', // List type - 'checkboxes'
'SMART_FILTER' =>"N",
'MULTIPLE' => 'N',
'IS_REQUIRED' => 'Y',
"IBLOCK_ID" = > 2
);
$arFields["VALUES"][0] = Array(
"XML_ID" => "
"VALUE" => "NO",
"SORT" => "100",
'DEF' => 'N'
);
$arFilter = Array('IBLOCK_ID'=>2, 'GLOBAL_ACTIVE'=>'Y','SECTION_ID'=>1);
$db_list = CIBlockSection::GetList(Array(), $arFilter, true);
while($ar_result = $db_list->GetNext())
{
$arrayID[] = $ar_result['ID'];
}
//print_r($arrayID);
/* Form an array */
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "PROPERTY_*");
$arFilter = Array("IBLOCK_ID"=>2, "SECTION_ID"=>$arrayID);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNext()){
$elementId = $ob['ID'];
$iblockId = 2;
CIBlockElement::SetPropertyValuesEx($elementId, $iblockId, ['Export' => 'YES']);
The debugger shows that all elements pass. but no change occurs.
What could be wrong?
Answer the question
In order to leave comments, you need to log in
CIBlockElement::SetPropertyValuesEx($elementId, $iblockId, ['Export' => 'YES']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question