CCrmExternalSaleImport::ParseOrderDataOrderDiscounts

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmExternalSaleImport
  4. ParseOrderDataOrderDiscounts
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_external_sale_import.php
  • Класс: \CCrmExternalSaleImport
  • Вызов: CCrmExternalSaleImport::ParseOrderDataOrderDiscounts
private function ParseOrderDataOrderDiscounts($document, $arSettings, &$arOrder)
{
	if (!is_array($document["Discount"]))
		return;

	$arOrder["DISCOUNTS"] = array();
	foreach ($document["Discount"] as $arDiscount)
	{
		$arDiscount = $arDiscount["#"];
		$arResultTmp = array();

		foreach ($arDiscount as $key => $value)
		{
			$value = $value[0]["#"];
			switch ($key)
			{
				case 'ItemName':
					$arResultTmp["NAME"] = $value;
					break;
				case 'InPrice':
					$arResultTmp["IN_PRICE"] = (mb_strtolower($value) == 'true') ? true : false;
					break;
				case 'Amount':
					$arResultTmp["PRICE"] = str_replace($arSettings["SumFormat"]["CRD"], ".", $value);
					break;
				default:
					$arResultTmp[$key] = $value;
					break;
			}
		}

		$arOrder["DISCOUNTS"][] = $arResultTmp;
	}
}

Добавить комментарий