Documentation

Update

bool
CIBlockProperty::Update(
 int ID,
 array arFields
);

The method changes parameters of a property.

Parameters

ParameterDescription
ID Property ID.
arFields An array of the format Array("field"=>"value", ...) containing values of the property fields.

Additionally, it can contain the field VALUES which is an array Array(array("VALUE"=>"value", "DEF"=>"default (Y/N)", "SORT"=>"sort weight"),...); this allows to set the selection options for the LIST properties. See the UpdateEnum function description for more information.

Return Values

The method returns true on success. In case of failure, it returns false and sets the property LAST_ERROR to the error description.

See Also

  • CIBlockProperty::Add
  • Property fields

    Example


    <?
    $arFields = Array(
      "NAME" => "Colour",
      "ACTIVE" => "Y",
      "SORT" => "100",
      "CODE" => "color",
      "PROPERTY_TYPE" => "L",
      "IBLOCK_ID" => 11
      );
    
    $arFields["VALUES"][0] = Array(
      "VALUE" => "Red",
      "DEF" => "N",
      "SORT" => "100"
    }
    
    $arFields["VALUES"][1] = Array(
      "VALUE" => "Yellow",
      "DEF" => "N",
      "SORT" => "200"
    }
    
    $arFields["VALUES"][2] = Array(
      "VALUE" => "Green",
      "DEF" => "Y",
      "SORT" => "300"
    }
    
    $ibp = new CIBlockProperty;
    if(!$ibp->Update($ID, $arFields))
    	echo $ibp->LAST_ERROR;
    ?
  • © «Bitrix24», 2001-2024