Answer the question
In order to leave comments, you need to log in
Which query shows a particular error in the script?
good afternoon!
wrote a script handler for deleting a product from the basket of pending goods
$CART_PRODUCT_ID=intval($_REQUEST['id']);
if (CSaleBasket::Delete($CART_PRODUCT_ID)) {
echo "успешно";
}
else {
echo "ошибка";
echo $CART_PRODUCT_ID;
}
Answer the question
In order to leave comments, you need to log in
It's better to use the new API to add to cart:
Bitrix\Main\Loader::includeModule("catalog");
$fields = [
'PRODUCT_ID' => 98, // ID товара, обязательно
'QUANTITY' => 2, // количество, обязательно
'PROPS' => [
['NAME' => 'Test prop', 'CODE' => 'TEST_PROP', 'VALUE' => 'test value'],
],
];
$r = Bitrix\Catalog\Product\Basket::addProduct($fields);
if (!$r->isSuccess()) {
var_dump($r->getErrorMessages());
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question