Update
int CSaleOrderProps::Update( int ID, array arFields );
The method Update replaces values of the specified property with the new ones.
Parameters
Parameter | Description |
---|---|
ID | The ID of the property whose values are to be updated. |
arFields | Associated array of the order new parameters whose keys are the order
parameter names, and values are the parameter values. The following values
are possible:
|
Returned values
The ID of the modified order property.
Example
<? $arFields = array( "PERSON_TYPE_ID" => 2, "NAME" => "Includes", "TYPE" => "RADIO", "REQUIED" => "Y", "DEFAULT_VALUE" => "F", "SORT" => 100, "CODE" => "COMPLECT", "USER_PROPS" => "N", "IS_LOCATION" => "N", "IS_LOCATION4TAX" => "N", "PROPS_GROUP_ID" => 1, "SIZE1" => 0, "SIZE2" => 0, "DESCRIPTION" => "", "IS_EMAIL" => "N", "IS_PROFILE_NAME" => "N", "IS_PAYER" => "N" ); // If the prop ID is set, update it; otherwise create new if ($ID>0) { if (!CSaleOrderProps::Update($ID, $arFields)) { echo "Error updating property"; } else { // Update mnemonic code (redundant data for speed-up) $db_order_props_tmp = CSaleOrderPropsValue::GetList(($b="NAME"), ($o="ASC"), Array("ORDER_PROPS_ID"=>$ID)); while ($ar_order_props_tmp = $db_order_props_tmp->Fetch()) { CSaleOrderPropsValue::Update($ar_order_props_tmp["ID"], array("CODE" => "COMPLECT")); } } } else { $ID = CSaleOrderProps::Add($arFields); if ($ID<=0) echo "error updating property"; } ?>
© «Bitrix24», 2001-2024