Bitrix Site Manager

CSaleOrder::GetList

CDBResult
CSaleOrder::GetList(
  array arOrder = Array("ID"=>"DESC"),
  array arFilter = Array()
);

The method GetList retrieves an optionally sorted and filtered list of orders.

Parameters

ParameterDescription
arOrder Associated array specifying how the returned order list is to be sorted. Each pair "key-value" is applied consequently. The keys are the sorting field names. The values are the sort order definitions.

The following keys are possible:
  • ID - the order ID;
  • LID - the ID of the site from which an order originates;
  • PAYED - specifies whether the order is paid (Y/N);
  • DATE_PAYED - the date of the order payment;
  • CANCELED - specifies whether the order is canceled (Y/N);
  • DATE_CANCELED - the date of the order cancellation;
  • STATUS_ID - the order status ID;
  • PAY_SYSTEM_ID - pay system to handle the payment;
  • DATE_STATUS - the date the order status changed;
  • PRICE - total order price;
  • CURRENCY - currency of the order price;
  • DATE_INSERT - the date the order was created;
  • DATE_UPDATE - the date the order was last modified.
Possible values:
  • ASC - ascending;
  • DESC - descending.
arFilter The filter is an associated array whose keys are the order parameter names, and values are the conditions to apply to parameter values.

The following keys are possible:
  • ID - the order ID;
  • DATE_INSERT - the date the order was created;
  • 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);
  • 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;
  • CANCELED - specifies whether the order is canceled (Y/N);
  • STATUS_ID - the order status ID;
  • ALLOW_DELIVERY - specifies whether the order can be shipped (Y/N);
  • DATE_STATUS - the date the order status changed;
  • CURRENCY - currency of the order price;
  • PRICE - total order price;
  • USER_ID - the customer user ID;
  • PAY_SYSTEM_ID - pay system to handle the payment;
  • DELIVERY_ID - the ID of a delivery service that will handle the order shipment;
  • BUYER - the customer login, first and last names, e-mail address.
The filter conditions allow comparison operators. To use them, insert an operator in the beginning of the desired filter key. The following operators are supported: !, >=, >, <=, <.

The default operator is =.

Return Values

Returns a CDBResult instance containing array with the following keys.

Key Description
ID The order ID.
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.
DATE_STATUS The date the order status changed.
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.
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.
DATE_UPDATE The date the order was last modified.
USER_DESCRIPTION Customer's order description.
ADDITIONAL_INFO Additional information on the order.
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.
COMMENTS Auxiliary comments.
TAX_VALUE Total amount of tax.
STAT_GID The event parameter for use in the Statistics module.
DATE_INSERT_FORMAT The date the order was created (in the current site format).
DATE_UPDATE_FORMAT The date the order was last modified (in the current site format).
DATE_STATUS_FORMAT The date the order status was last modified (in the current site format).
DATE_CANCELED_FORMAT The date the order cancellation flag was last modified (in the current site format).
DATE_PAYED_FORMAT The date the order payment flag was last modified (in the current site format).
PS_RESPONSE_DATE_FORMAT The date the pay system status was last received (in the current site format).
DATE_ALLOW_DELIVERY_FORMAT The date the order shipment flag was last received (in the current site format).

Example



<?
// Print dates of all orders the current user 
// made within the month, sorted by the order date
$arFilter = Array(
    "USER_ID" => $USER->GetID(),
    ">=DATE_INSERT" => 
        date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), 
             mktime(0, 0, 0, date("n"), 1, date("Y")))
   );

$db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), 
                                $arFilter);
while ($ar_sales = $db_sales->Fetch())
{
   echo $ar_sales["DATE_INSERT_FORMAT"]."<br>";
}
?>