Answer the question
In order to leave comments, you need to log in
How to export all product ids in Bitrix cart?
It is necessary to export all id in the format 123, 321, 123123, 12333
<?
$products_in_cart = CSaleBasket::GetList(
array(), // сортировка
array(
'FUSER_ID' => CSaleBasket::GetBasketUserID(),
'LID' => SITE_ID,
'ORDER_ID' => NULL
),
false, // группировать
false, // постраничная навигация
array('ID')
);
foreach ($products_in_cart->arResult as $product) {
echo $product['ID'];
}
?>
Answer the question
In order to leave comments, you need to log in
Collect data into an array, and then process
<?foreach ($products_in_cart->arResult as $product) {
$arProdutsIDs[] = $product['ID'];
}
//объединяем все ID в строку
$string_id = implode(",", $arProdutsIDs);?>
<? echo $string_id; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question