- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/classes/general/cml2.php
- Класс: CIBlockCMLImport
- Вызов: CIBlockCMLImport::ConvertDiscounts
function ConvertDiscounts($arDiscounts)
{
if (is_array($arDiscounts) && count($arDiscounts) > 0)
{
if (!array_key_exists(0, $arDiscounts))
$arDiscounts[0] = 0;
ksort($arDiscounts);
$keys = array_keys($arDiscounts);
$cnt = count($keys);
for ($i = 0; $i < $cnt; $i++)
{
$arDiscounts[$keys[$i]] = array(
"QUANTITY_FROM" => $keys[$i] + 1,
"QUANTITY_TO" => $i < $cnt ? $keys[$i + 1] : "",
"PERCENT" => $arDiscounts[$keys[$i]],
);
}
}
else
{
$arDiscounts = array(
array(
"QUANTITY_FROM" => "",
"QUANTITY_TO" => "",
"PERCENT" => 0,
),
);
}
return $arDiscounts;
}