Documentation

Update

int
CSaleOrder::Update(
  int ID,
  array arFields
);

The method Update replaces parameters of an order with the new ones.

Parameters

ParameterDescription
ID The order ID.
arFieldsAssociated array of the order new parameters whose keys are the order parameter names, and values are the parameter values.

The following values are possible:
  • LID - the ID of the site from which an order originates;
  • PERSON_TYPE_ID - payer type of the visitor who made the order (customer);
  • PAYED - specifies whether the order is paid (Y/N);
  • DATE_PAYED - the date of the order payment;
  • EMP_PAYED_ID - the ID of the user (web shop member) who has set the PAYED flag;
  • CANCELED - specifies whether the order is canceled (Y/N);
  • DATE_CANCELED - the date of the order cancellation;
  • EMP_CANCELED_ID - the ID of the user (web shop member) who has set the CANCELED flag;
  • REASON_CANCELED - text description of the order cancellation reason;
  • STATUS_ID - the order status ID;
  • EMP_STATUS_ID - the ID of the user (web shop member) who has set the current STATUS_ID;
  • PRICE_DELIVERY - cost of the order delivery;
  • ALLOW_DELIVERY - specifies whether the order can be shipped (Y/N);
  • DATE_ALLOW_DELIVERY - the date when the order was subjected for shipment;
  • EMP_ALLOW_DELIVERY_ID - the ID of the user (web shop member) who has set the current ALLOW_DELIVERY status;
  • PRICE - total order price;
  • CURRENCY - currency of the order price;
  • DISCOUNT_VALUE - total discount value;
  • USER_ID - the user ID of the customer (must be specified);
  • PAY_SYSTEM_ID - pay system to handle the payment;
  • DELIVERY_ID - the ID of a delivery service that will handle the order shipment;
  • DATE_INSERT - the date the order was created;
  • USER_DESCRIPTION - customer's order description;
  • ADDITIONAL_INFO - additional information on the order;
  • COMMENTS - auxiliary comments;
  • TAX_VALUE - total amount of tax;
  • STAT_GID - the event parameter for use in the Statistics module;
  • PS_STATUS - specifies that the order has been successfully paid (Y/N). Available only for those pay systems which can automatically notify of their orders state;
  • PS_STATUS_CODE - code of the pay system status (depends on the pay system);
  • PS_STATUS_DESCRIPTION - description of the pay system order payment result;
  • PS_STATUS_MESSAGE - message returned from the pay system;
  • PS_SUM - amount of money which was actually paid via the pay system;
  • PS_CURRENCY - payment currency;
  • PS_RESPONSE_DATE - the date when the pay system status was received.

Returned values

Returns the ID of the modified order on success, or false otherwise.

Example


<?
$arOrder = CSaleOrder::GetByID($ID);
if ($arOrder)
{
    $arFields = array(
       "PAYED" => "Y",
       "DATE_PAYED" => 
           Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG))),
       "USER_ID" => $arOrder["USER_ID"],
       "EMP_PAYED_ID" => $USER->GetID()
    );
    CSaleOrder::Update($ID, $arFields);
}
?>
© «Bitrix24», 2001-2024