GetList
CDBResult CSaleDelivery::GetList( array arOrder = Array("SORT"=>"ASC", "NAME"=>"ASC"), array arFilter = Array() );
The method GetList returns a filtered list of delivery services.
Parameters
Parameter | Description |
---|---|
arOrder | Associated array containing parameter used to sort the returned list.
The list is sorted by all array entries consecutively. The array keys are
the delivery service parameter names. The corresponding values are the sort
direction identifiers. The following keys are possible:
|
arFilter | The filter is an associated array whose keys are the delivery service
parameter names, and values are the conditions. The following keys are possible:
|
Returned values
Returns an instance of CDBResult, containing a set of associated arrays with the following keys.
Key | Description |
---|---|
ID | The delivery service ID. |
NAME | Name of the delivery service. |
LID | The ID of the site to which this service is bound. |
PERIOD_FROM | Minimum time of delivery. |
PERIOD_TO | Maximum time of delivery. |
PERIOD_TYPE | Time of delivery measurement unit: H - hours, D - days, M - months. |
WEIGHT_FROM | Minimum order weight that this delivery service can handle (measurement unit must be common within the site). |
WEIGHT_TO | Maximum order weight that this delivery service can handle (measurement unit must be common within the site). |
ORDER_PRICE_FROM | Minimum order price that this delivery service can handle. |
ORDER_PRICE_TO | Maximum order price that this delivery service can handle. |
ORDER_CURRENCY | Currency in which both ORDER_PRICE_FROM and ORDER_PRICE_TO are specified. |
ACTIVE | Delivery service active state flag (Y/N). |
PRICE | Cost of delivery. |
CURRENCY | Currency of the cost. |
SORT | Sort weight. |
DESCRIPTION | Delivery service description. |
Example
<? // Select active delivery services // firstly sorted by the sort weight and secondly by name. // The selected services are available for the current site, // can handle orders with weight $ORDER_WEIGHT and // cost $ORDER_PRICE (in the current site currency), // can deliver to $DELIVERY_LOCATION $db_dtype = CSaleDelivery::GetList( Array("SORT"=>"ASC", "NAME"=>"ASC"), Array("LID"=>SITE_ID, "WEIGHT"=>$ORDER_WEIGHT, "ORDER_PRICE"=>$ORDER_PRICE, "ACTIVE"=>"Y", "LOCATION"=>$DELIVERY_LOCATION) ); if ($ar_dtype = $db_dtype->Fetch()) { echo "The following delivery services are available:<br>"; do { echo $ar_dtype["NAME"]. " - cost ". CurrencyFormat($ar_dtype["PRICE"], $ar_dtype["CURRENCY"])."<br>"; } while ($ar_dtype = $db_dtype->Fetch()) } else { else "Cannot find an appropriate delivery service<br>"; } ?>
© «Bitrix24», 2001-2024