• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/helpers/controller/action/entity/order.php
  • Класс: BitrixSaleHelpersControllerActionEntityOrder
  • Вызов: Order::getBasketProduct
static function getBasketProduct(SaleBasketItemBase $basketItem)
{
	$arBasketItem = $basketItem->getFieldValues();
	if ($basketItem->getVatRate() > 0)
	{
		$arBasketItem['VAT_VALUE'] = PriceMaths::roundPrecision($basketItem->getVat());
	}

	$arBasketItem['QUANTITY'] = $basketItem->getQuantity();
	$arBasketItem['DISCOUNT_PRICE'] = PriceMaths::roundPrecision($basketItem->getDiscountPrice());

	$arBasketItem['DISCOUNT_PRICE_PERCENT'] = 0;
	if ($arBasketItem['CUSTOM_PRICE'] !== 'Y')
	{
		$arBasketItem['DISCOUNT_PRICE_PERCENT'] = SaleDiscount::calculateDiscountPercent(
			$arBasketItem['BASE_PRICE'],
			$arBasketItem['DISCOUNT_PRICE']
		);
		if ($arBasketItem['DISCOUNT_PRICE_PERCENT'] === null)
		{
			$arBasketItem['DISCOUNT_PRICE_PERCENT'] = 0;
		}
		else
		{
			$arBasketItem['DISCOUNT_PRICE_PERCENT'] = PriceMaths::roundPrecision($arBasketItem['DISCOUNT_PRICE_PERCENT']);
		}
	}

	$arBasketItem['PROPS'] = [];
	/** @var SaleBasketPropertiesCollection $propertyCollection */
	$propertyCollection = $basketItem->getPropertyCollection();
	$propList = $propertyCollection->getPropertyValues();
	foreach ($propList as &$prop)
	{
		if ($prop['CODE'] === 'CATALOG.XML_ID'
			|| $prop['CODE'] === 'PRODUCT.XML_ID'
			|| $prop['CODE'] === 'SUM_OF_CHARGE'
		)
		{
			continue;
		}

		$prop = array_filter($prop, ['CSaleBasketHelper', 'filterFields']);
		$arBasketItem['PROPS'][] = $prop;
	}
	unset($prop);

	$arBasketItem['PRICE'] = PriceMaths::roundPrecision($basketItem->getPrice());
	$arBasketItem['BASE_PRICE'] = PriceMaths::roundPrecision($basketItem->getBasePrice());

	$arBasketItem['SUM'] = PriceMaths::roundPrecision($arBasketItem['PRICE'] * $basketItem->getQuantity());
	$arBasketItem['SUM_BASE'] = PriceMaths::roundPrecision($basketItem->getBasePrice() * $basketItem->getQuantity());

	$arBasketItem['SUM_DISCOUNT_DIFF'] = PriceMaths::roundPrecision($arBasketItem['SUM_BASE'] - $arBasketItem['SUM']);

	$dimension = $basketItem->getField('DIMENSIONS');
	if($dimension && is_string($dimension) && CheckSerializedData($dimension))
	{
		$arBasketItem['DIMENSIONS'] = unserialize($dimension, ['allowed_classes' => false]);
	}

	if (!empty($arBasketItem) && static::useCatalog())
	{
		$measure = getMeasures([$basketItem->getId() => $arBasketItem]);
		$arBasketItem = $measure[$basketItem->getId()];
	}

	return $arBasketItem;
}