Bitrix Site Manager

CSaleBasket::Update

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

The method Update replaces parameters of the specified product with the new ones.

Parameters

ParameterDescription
ID The ID of the basket item.
arFields Associated array containing new parameters of basket item. The following keys are possible:
  • PRODUCT_ID - the product ID unique within the module;
  • PRODUCT_PRICE_ID - the product auxiliary ID;
  • PRICE - price of a single product item;
  • CURRENCY - currency of the PRICE;
  • WEIGHT - weight of a single product item ;
  • QUANTITY - number of product items. If QUANTITY is null, the product is removed from the basket;
  • LID - the site from which purchase originates;
  • DELAY - flag "save for later purchase" (Y/N);
  • CAN_BUY - flag "can be purchased" (Y/N) - can be set automatically if the actualization callback function is provided;
  • NAME - product name (required);
  • CALLBACK_FUNC - name of the callback function used to maintain the basket actuals (see CSaleBasket::Add for details);
  • MODULE - the module adding the product;
  • NOTES - other special notes;
  • ORDER_CALLBACK_FUNC - name of the ordering process callback function (see CSaleBasket::Add for details);
  • DETAIL_PAGE_URL - URL of the page with the product details;
  • PROPS - array of properties of the product in the basket. Each element of this array is its turn an array of the following format:
    array("NAME" =>  "Property name", 
          "CODE" =>  "Property identifier",  
          "VALUE" => "Property value", 
          "SORT" =>  "Sort weight")

Return Values

Returns the ID of the updated basket item.

Example



<?
// Change the quantity of a product $ID 
// to 2 pcs and hold the product
$arFields = array(
   "QUANTITY" => 2,
   "DELAY" => "Y"
);
CSaleBasket::Update($ID, $arFields);
?>