Bitrix Site Manager

CSaleBasket::UpdatePrice

CSaleBasket::UpdatePrice(
  int ID,
  string CALLBACK_FUNC = "",
  string MODULE = "",
  int PRODUCT_ID = 0,
  int QUANTITY = 0
);

The method UpdatePrice updates the basket item using the callback function.

Parameters

ParameterDescription
ID The ID of the basket item.
CALLBACK_FUNC Name of the callback function used to maintain the basket actuals.
MODULE Module adding the product to the basket.
PRODUCT_ID The product ID unique within the module.
QUANTITY Number of products.

Example



<?
//
// GetBasketList() - the standard e-Store module function
// 
function GetBasketList()
{
   CSaleBasket::Init();
   $arRes = array();
   $db_res = CSaleBasket::GetList(($by="NAME"), 
                                  ($order="ASC"), 
                                  array("FUSER_ID"=>$_SESSION["SALE_USER_ID"], 
                                        "LID"=>SITE_ID, "ORDER_ID"=>"NULL"));

   while ($res = $db_res->GetNext())
   {
      if (strlen($res["CALLBACK_FUNC"])>0)
      {
         CSaleBasket::UpdatePrice($res["ID"], 
                                  $res["CALLBACK_FUNC"], 
                                  $res["MODULE"], 
                                  $res["PRODUCT_ID"], 
                                  $res["QUANTITY"]);
         $res = CSaleBasket::GetByID($res["ID"]);
      }
      $arRes[] = $res;
   }
   return $arRes;
}

$arBasket = GetBasketList();

echo "<pre>";
print_r($arBasket);
echo "</pre>";
?>