Bitrix Site Manager

CSaleDelivery::Update

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

The method Update replaces parameters of the delivery service with the new ones.

Parameters

ParameterDescription
ID The ID of the delivery service whose parameters are to be updated.
arFields Associated array containing new parameters of the delivery service. In this array, the keys are the parameter names, and the values are the delivery parameter values. The following keys are possible:
  • NAME - name of the delivery service (required; specified in the language of the site to which this delivery service is bound);
  • 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);
  • 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;
  • LOCATIONS - array of arrays in the format:
    array("LOCATION_ID"=>"location_ID or location_group_ID",
          "LOCATION_TYPE"=>"L - location or G - group")
    This array defines locations and group of locations allowed by this delivery service.

Return Values

Returns the ID of the updated record on success or false otherwise.

Example



<?
$arFields = array(
   "NAME" => "By courier",
   "LID" => "en",
   "PERIOD_FROM" => 1,
   "PERIOD_TO" => 3,
   "PERIOD_TYPE" => "D",
   "WEIGHT_FROM" => 0,
   "WEIGHT_TO" => 2500,
   "ORDER_PRICE_FROM" => 0,
   "ORDER_PRICE_TO" => 10000,
   "ORDER_CURRENCY" => "EUR",
   "ACTIVE" => "Y",
   "PRICE" => 58,
   "CURRENCY" => "RUR",
   "SORT" => 100,
   "DESCRIPTION" => "Delivers within 3 to 10 business days".
                    "after the order acceptance.",
   "LOCATIONS" => array(
      array("LOCATION_ID"=>1, "LOCATION_TYPE"=>"L"),
      array("LOCATION_ID"=>3, "LOCATION_TYPE"=>"G")
      )
);

if (!CSaleDelivery::Update($ID, $arFields))
   echo "Error updating the delivery service";
?>