<?php
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
$ORDER_ID='4455';
CModule::IncludeModule('sale');
$res = CSaleBasket::GetList(array(), array("ORDER_ID" => $ORDER_ID));
$json_product=array();
while ($arItem = $res->Fetch()) {
var_dump($arItem);
$price_list[] = array(
'name' => $arItem['NAME'],
'id' => $arItem['PRODUCT_ID'],
'price' => $arItem['PRICE'],
'quantity' => $arItem['QUANTITY']
);
}
?>
use Bitrix\Sale;
$basket = Sale\Order::load($orderId)->getBasket(); // получили корзину по $orderId
$basketItems = $basket->getBasketItems(); // получили товары корзины
foreach ($basketItems as $basketItem) {
$basketPropertyCollection = $item->getPropertyCollection(); // вот и свойства товара
foreach ($basketPropertyCollection as $propertyItem) {
if ($propertyItem->getField('CODE') == 'ARTICLE') {
var_dump($propertyItem->getValue());
}
}
}
Array
(
[0] => Array
(
[name] => Товар 1
[id] => 358
[price] => 90.0000
[quantity] => 1
)
[1] => Array
(
[name] => Товар 2
[id] => 5017
[price] => 500.0000
[quantity] => 1
)
)
<?$prop=CIBlockElement::GetByID(358)->GetNextElement()->GetProperties();
echo $prop[CML2_ARTICLE][VALUE]?>
Array
(
[0] => Array
(
[name] => Товар 1
[id] => 358
[price] => 90.0000
[quantity] => 1
[ARTICLE] => 122
)
[1] => Array
(
[name] => Товар 2
[id] => 5017
[price] => 500.0000
[quantity] => 1
[ARTICLE] => 123
)
)
$db_elemens = CSaleBasket::GetList(...);
while($obElement = $db_elemens->GetNextElement())
{
$item= $obElement->GetFields();
$item["PROPERTIES"] = $obElement->GetProperties();
$arResult["ITEMS"][] = $item;
}