Answer the question
In order to leave comments, you need to log in
How to get a list of products from an unsaved order?
Hello, how can I get a list of products that have not yet been saved order? It is necessary to use the new core Bitrix D7.
\Bitrix\Main\Loader::includeModule('Sale');
$basket = \Bitrix\Sale\Basket::loadItemsForFUser(\Bitrix\Sale\Fuser::getId(), 's1');
$order = Bitrix\Sale\Order::create("s1", \Bitrix\Sale\Fuser::getId());
$order->setPersonTypeId(1);
$order->setBasket($basket);
Answer the question
In order to leave comments, you need to log in
You can get the shopping cart like this:
/** @var \Bitrix\Sale\BasketItem $basketItem */
foreach ($order->getBasket() as $basketItem) {
echo $basketItem->getField('NAME');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question