• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/compatible/basketcompatibility.php
  • Класс: BitrixSaleCompatibleBasketCompatibility
  • Вызов: BasketCompatibility::convertBasketItemToArray
static function convertBasketItemToArray(SaleBasketItem $basketItem)
{
	$fields = $basketItem->getFieldValues();

	/** @var SaleBasketItemCollection $collection */
	$collection = $basketItem->getCollection();

	/** @var SaleBasket $basket */
	if (!$basket = $collection->getBasket())
	{
		throw new MainObjectNotFoundException('Entity "Basket" not found');
	}

	if (empty($fields['LID']))
		$fields['LID'] = $basket->getSiteId();

	if (empty($fields['LID']))
	{
		if ($order = $basket->getOrder())
		{
			$fields['LID'] = $order->getField('LID');
		}
		//$order->getField('LID')

	}

	if (empty($fields['FUSER_ID']))
		$fields['FUSER_ID'] = $basket->getFUserId(true);


	/** @var SaleBasketPropertiesCollection $propertyCollection */
	if ($propertyCollection = $basketItem->getPropertyCollection())
	{
		$fields['PROPS'] = $propertyCollection->getPropertyValues();
	}

	return $fields;
}