Answer the question
In order to leave comments, you need to log in
Bitrix: CSaleBasket::Update - why is the quantity being modified, but the price is not?
Created a handler file. The quantity in the cart is updated, but the price is not. Why is unclear.
<?
require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
if(CModule::IncludeModule('sale')){
$arBasketItems = array();
$dbBasketItems = CSaleBasket::GetList(
array(
"NAME" => "ASC",
"ID" => "ASC"
),
array(
"FUSER_ID" => CSaleBasket::GetBasketUserID(),
"LID" => SITE_ID,
"ORDER_ID" => "NULL",
"PRODUCT_ID" => $_POST['id']
),
false,
false,
array("ID", "PRODUCT_ID", "QUANTITY", "PRICE", "NAME")
);
while ($arItems = $dbBasketItems->Fetch()) {
$arBasketItems[] = $arItems;
}
}
$price = (int)$arBasketItems[0]['PRICE'];
$count = (int)$arBasketItems[0]['QUANTITY'];
if (CModule::IncludeModule("catalog"))
{
if($_POST['type']=='min'){
$arFields = array(
"QUANTITY" => $count-1,
"PRICE" => $price-1
);
}
if($_POST['type']=='plus'){
$arFields = array(
"QUANTITY" => $count + 1,
"PRICE" => $price+1
);
}
$ID = CSaleBasket::Update($arBasketItems[0]['ID'], $arFields);
}
?>
Answer the question
In order to leave comments, you need to log in
Here is the answer:
$arFields = array(
"CALLBACK_FUNC" => "",
"PRODUCT_PROVIDER_CLASS" => "",
"CUSTOM_PRICE" => "Y",
"IGNORE_CALLBACK_FUNC" => "Y"
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question