Add
int CSaleOrderProps::Add( array arFields );
The method Add creates a new order property based on the supplied parameters.
Parameters
Parameter | Description |
---|---|
arFields | Associated array of an order 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 added 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 property ID is set, change the property, otherwise add a new one if ($ID>0) { if (!CSaleOrderProps::Update($ID, $arFields)) { echo "Error modifying property"; } else { // Update the property value 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 adding property"; } ?>
© «Bitrix24», 2001-2024