Documentation

GetBasketUserID

This method has been deprecated. Use the class methods \Bitrix\Sale\Basket in the new core.

Description and parameters

int
CSaleBasket::GetBasketUserID(
 bool bSkipFUserInit = False
);

Method returns internal code of shopping cart owner. Static method.

Parameters

ParameterDescriptionAvailable from version
bSkipFUserInit By default, gets the value False.5.1.0

Example

<?
// Gets shopping cart records for the current user

$dbBasketItems = CSaleBasket::GetList(
        array(
                "NAME" => "ASC",
                "ID" => "ASC"
                ),
        array(
                "FUSER_ID" => CSaleBasket::GetBasketUserID(),
                "LID" => SITE_ID,
                "ORDER_ID" => "NULL"
                ),
        false,
        false,
        array()
        );
?>
//If you need to get a code of any other user (not current), you can proceed as follows: 

if ($arFUser = CSaleUser::GetList(array('USER_ID' => $GLOBALS['USER_ID'])))
         echo($arFUser);

//Particularly, by getting this code you can display for yourself the shopping cart of another user.

© «Bitrix24», 2001-2024