Documentation

DeleteAll

Method has been deprecated. Use the class methods \Bitrix\Sale\Basket of the new core.

Description and parameters

bool
CSaleBasket::DeleteAll(
 int fUserID[,
 bool bIncOrdered = false]
);

Method deletes all records from the shopping cart with internal owner fUserID (Including saved for later products as well as as subscribed products). Non-static method.

Call parameters

Parameter Description
fUserID Owner internal code.
bIncOrdered If flag is false (by default), deletes only records from shopping cart. If flag is true, deletes only the records that belong to already placed orders.

Examples

<?
if (CSaleBasket::DeleteAll(3, False))
    echo "User shopping cart with internal code 3 has been deleted successfully";
?>
//example of a call with autodetected fUserID
<?
CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
?>

Clear shopping cart for current user without involving products saved for later:

$res = CSaleBasket::GetList(array(), array(
                              'FUSER_ID' => CSaleBasket::GetBasketUserID(),
                              'LID' => SITE_ID,
                              'ORDER_ID' => 'null',
                              'DELAY' => 'N',
                              'CAN_BUY' => 'Y'));
while ($row = $res->fetch()) {
   CSaleBasket::Delete($row['ID']);
}


© «Bitrix24», 2001-2024
Up