• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/compatible/ordercompatibility.php
  • Класс: BitrixSaleCompatibleOrderCompatibility
  • Вызов: OrderCompatibility::convertOrderToArray
static function convertOrderToArray(SaleOrder $order)
{
	$fields = $order->getFieldValues();

	//getWeight
	$fields = array_merge($fields,
						  array(
							  'ORDER_WEIGHT' => 0,
							  'BASKET_ITEMS' => array(),
							  'ORDER_PROP' => array(),
							  'DISCOUNT_LIST' => array(),
							  'TAX_LIST' => array(),
							  'VAT_RATE' => $order->getVatRate(),
							  'VAT_SUM' => $order->getVatSum(),
						  ));

	/** @var SaleBasket $basket */
	if ($basket = $order->getBasket())
	{
		/** @var SaleBasketItem $basketItem */
		foreach ($basket as $basketItem)
		{
			/** @var BasketCompatibility $basketCompatibilityClassName */
			$basketCompatibilityClassName = static::getBasketCompatibilityClassName();

			$fields['BASKET_ITEMS'][] = $basketCompatibilityClassName::convertBasketItemToArray($basketItem);
		}

		$fields['ORDER_WEIGHT'] = $basket->getWeight();
	}

	/** @var SalePropertyValueCollection $basket */
	if ($propertyCollection = $order->getPropertyCollection())
	{
		/** @var SalePropertyValue $property */
		foreach ($propertyCollection as $property)
		{
//				$propertyValue = $property->getValue();
			$fields['ORDER_PROP'][$property->getPropertyId()] = $property->getValue();
		}
	}


	if ($propProfileName = $propertyCollection->getProfileName())
		$fields['PROFILE_NAME'] = $propProfileName->getValue();

	if ($propPayerName = $propertyCollection->getPayerName())
		$fields['PAYER_NAME'] = $propPayerName->getValue();

	if ($propUserEmail = $propertyCollection->getUserEmail())
		$fields['USER_EMAIL'] = $propUserEmail->getValue();

	if ($propDeliveryLocationZip = $propertyCollection->getDeliveryLocationZip())
		$fields['DELIVERY_LOCATION_ZIP'] = $propDeliveryLocationZip->getValue();

	if ($propDeliveryLocation = $propertyCollection->getDeliveryLocation())
		$fields['DELIVERY_LOCATION'] = $propDeliveryLocation->getValue();

	if ($propTaxLocation = $propertyCollection->getTaxLocation())
		$fields['TAX_LOCATION'] = $propTaxLocation->getValue();

	$fields['DISCOUNT_LIST'] = DiscountCompatibility::getOldDiscountResult();

	/** @var SaleTax $tax */
	if ($tax = $order->getTax())
	{
		$fields['TAX_LIST'] = $tax->getTaxList();
	}

	return $fields;
}