Documentation

UpdateEnum

CIBlockProperty::UpdateEnum(
 int ID,
 array arVALUES
);

The method sets the LIST property options.

Parameters

ParameterDescription
ID Property ID.
arVALUES An array of all values in the format Array("existing value ID"=>"array of values", ..., "new values", ...).

The array of values is the Array(array("VALUE"=>"value", "DEF"=>"default (Y/N)", "SORT"=>"sort weight"),...).

Remarks

Array arVALUES should contain a full list of values. All values existing in the property but missing from the array arVALUES will be deleted.

See Also

  • Possible values for properties of the type LIST
  • Class CIBlockPropetyEnum
  • CIBlockPropetyEnum::Update
  • CIBlockPropetyEnum::Add
  • Example


    <?
    $cnt = 0;
    $ar_all_values = Array();
    $db_enum_list = CIBlockProperty::GetPropertyEnum($PROP_ID, 
                                                     Array('SORT'=>'ASC'));
    while($ar_enum = $db_enum_list->Fetch())
    {
        $cnt++;
        $ar_all_values[$ar_enum['ID']] = Array('SORT'=>$cnt,
                                               'VALUE'=>$ar_enum['VALUE']);
    }
    
    CIBlockPropertyEnum::UpdateEnum($PROP_ID, $ar_all_values);
    ?>
    © «Bitrix24», 2001-2024