Bitrix Site Manager

CSaleDelivery::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

ParameterDescription
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:
  • NAME - name of the delivery service;
  • ID - the delivery service ID;
  • LID - the site to which this delivery 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;
  • PRICE - cost of delivery;
  • CURRENCY - currency of the cost ;
  • SORT - sort weight.
The following values are possible:
  • ASC - ascending;
  • DESC - descending.
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:
  • ID - the delivery service ID;
  • LID - the site to which this delivery 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);
  • WEIGHT - this value must be from WEIGHT_FROM to WEIGHT_TO (measurement unit must be common within the site);
  • ORDER_PRICE - this value must be from ORDER_PRICE_FROM to ORDER_PRICE_TO (specified in the base currency of the site identified by LID);
  • 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 values ORDER_... are specified;
  • ACTIVE - delivery service active state flag (Y/N) ;
  • LOCATION - this value (location code) should be one of those that this delivery service allows.

Return 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>";
}
?>