$order = \Bitrix\Sale\Order::load($orderId);
$oldPrice = $order->getField('PRICE');
$newval = CCurrencyRates::ConvertCurrency($oldPrice, "EUR", "RUB");
$newPrice = round($newval);
$order->setField('PRICE', $newPrice);
$result = $order->save();
global $USER;
// Получаем номер телефона и адрес стационара текущего юзера
// $filter = Array("ID" => $_SESSION['SESS_AUTH']['USER_ID']);
$arParams["SELECT"] = array( "UF_SELECT_MON", "UF_SELECT_TUE", "UF_SELECT_WED", "UF_SELECT_THU", "UF_SELECT_FRI", "UF_SELECT_SAT", "UF_SELECT_SUN", "UF_ADDRESS");
$rsUsers = CUser::GetList(($by="personal_phone"), ($order="desc"), false, $arParams);
while ($arUser = $rsUsers->Fetch()) {
$tmp[] = $arUser["UF_SELECT_MON"]; //записываю все ID нужных свойств
$tmp[] = $arUser["UF_SELECT_TUE"];
$tmp[] = $arUser["UF_SELECT_WED"];
$tmp[] = $arUser["UF_SELECT_THU"];
$tmp[] = $arUser["UF_SELECT_FRI"];
$tmp[] = $arUser["UF_SELECT_SAT"];
$tmp[] = $arUser["UF_SELECT_SUN"];
$allUser[] = array( // тут запись всех пользователей со свойствами
"ID" => $arUser["ID"],
"NAME" => $arUser["NAME"],
"LAST_NAME" => $arUser["LAST_NAME"],
"UF_SELECT_MON" => $arUser["UF_SELECT_MON"],
"UF_SELECT_TUE" => $arUser["UF_SELECT_TUE"],
"UF_SELECT_WED" => $arUser["UF_SELECT_WED"],
"UF_SELECT_THU" => $arUser["UF_SELECT_THU"],
"UF_SELECT_FRI" => $arUser["UF_SELECT_FRI"],
"UF_SELECT_SAT" => $arUser["UF_SELECT_SAT"],
"UF_SELECT_SUN" => $arUser["UF_SELECT_SUN"],
"UF_ADDRESS" => $arUser["UF_ADDRESS"]
);
}
foreach ($tmp as $key => $value) {
foreach ($value as $k => $v) {
$arElementsId[] = $v; // тут формирую массив из всех ID связанных элементов
}
}
$arSelectedElements = []; // пустой массив для загруженных связанных элементов
$rsElements = \CIBlockElement::GetList(['ID'=>'ASC'],['IBLOCK_ID' => 17, 'ID' => $arElementsId]);
while ($arElement = $rsElements->fetch()) {
$arSelectedElements[$arElement['ID']] = $arElement['NAME'];
}
$arDaysFields = [
'UF_SELECT_MON',
'UF_SELECT_TUE',
'UF_SELECT_WED',
'UF_SELECT_THU',
'UF_SELECT_FRI',
'UF_SELECT_SAT',
'UF_SELECT_SUN'
];
foreach ($allUser as $topKey => $userArray) {
// по всем юзерам
foreach ($arDaysFields as $field) {
// по всем дням
foreach ($userArray[$field] as $innerKey => $element) {
// заменяем в исходном массиве айди элементов на их NAME
$userArray[$field][$innerKey] = $arSelectedElements[$element];
}
}
}
Array
(
[ID] => 1
[NAME] => Иванов
[LAST_NAME] => Иван
[UF_SELECT_MON] => Array
(
[0] => Багет
[1] => 1941
)
[UF_SELECT_TUE] => Array
(
[0] => 1941
[1] => 1921
)
[UF_SELECT_WED] => Array
(
[0] => 1846
[1] => 1842
)
[UF_SELECT_THU] => Array
(
[0] => 1968
[1] => 1921
[2] => 1963
)
[UF_SELECT_FRI] => Array
(
[0] => 1845
[1] => 1931
[2] => 1846
[3] => 1856
[4] => 1973
[5] => 1886
)
[UF_SELECT_SAT] => Array
(
[0] => 1880
[1] => 1845
[2] => 1941
)
[UF_SELECT_SUN] => Array
(
[0] => 1845
[1] => 1995
[2] => 1971
[3] => 1937
[4] => 1855
[5] => 1852
[6] => 1871
[7] => 1929
[8] => 1974
[9] => 1903
[10] => 1870
[11] => 1975
[12] => 1966
)
[UF_ADDRESS] => 1373
)
Array
(
[ID] => 1
[NAME] => Иванов
[LAST_NAME] => Иван
[UF_SELECT_MON] => Array
(
[0] => Багет
[1] => Баранина тушеная с рагу из баклажанов и кабачков 260/15
)
[UF_SELECT_TUE] => Array
(
[0] => 1941
[1] => 1921
)
[UF_SELECT_WED] => Array
(
[0] => 1846
[1] => 1842
)
[UF_SELECT_THU] => Array
(
[0] => 1968
[1] => 1921
[2] => 1963
)
[UF_SELECT_FRI] => Array
(
[0] => 1845
[1] => 1931
[2] => 1846
[3] => 1856
[4] => 1973
[5] => 1886
)
[UF_SELECT_SAT] => Array
(
[0] => 1880
[1] => 1845
[2] => 1941
)
[UF_SELECT_SUN] => Array
(
[0] => 1845
[1] => 1995
[2] => 1971
[3] => 1937
[4] => 1855
[5] => 1852
[6] => 1871
[7] => 1929
[8] => 1974
[9] => 1903
[10] => 1870
[11] => 1975
[12] => 1966
)
[UF_ADDRESS] => 1373
)
Array
(
[ID] => 1
[NAME] => Иванов
[LAST_NAME] => Иван
[UF_SELECT_MON] => Array
(
[0] => Багет
[1] => Баранина тушеная с рагу из баклажанов и кабачков 260/15
)
[UF_SELECT_TUE] => Array
(
[0] => Баранина тушеная с рагу из баклажанов и кабачков 260/15
[1] => 1921
)
[UF_SELECT_WED] => Array
(
[0] => 1846
[1] => 1842
)
[UF_SELECT_THU] => Array
(
[0] => 1968
[1] => 1921
[2] => 1963
)
[UF_SELECT_FRI] => Array
(
[0] => 1845
[1] => 1931
[2] => 1846
[3] => 1856
[4] => 1973
[5] => 1886
)
[UF_SELECT_SAT] => Array
(
[0] => 1880
[1] => 1845
[2] => 1941
)
[UF_SELECT_SUN] => Array
(
[0] => 1845
[1] => 1995
[2] => 1971
[3] => 1937
[4] => 1855
[5] => 1852
[6] => 1871
[7] => 1929
[8] => 1974
[9] => 1903
[10] => 1870
[11] => 1975
[12] => 1966
)
[UF_ADDRESS] => 1373
)
Array
(
[ID] => 1
[NAME] => Иванов
[LAST_NAME] => Иван
[UF_SELECT_MON] => Array
(
[0] => Багет
[1] => Баранина тушеная с рагу из баклажанов и кабачков 260/15
)
[UF_SELECT_TUE] => Array
(
[0] => Баранина тушеная с рагу из баклажанов и кабачков 260/15
[1] => Борщ с говядиной 200/30г
)
[UF_SELECT_WED] => Array
(
[0] => 1846
[1] => 1842
)
[UF_SELECT_THU] => Array
(
[0] => 1968
[1] => 1921
[2] => 1963
)
[UF_SELECT_FRI] => Array
(
[0] => 1845
[1] => 1931
[2] => 1846
[3] => 1856
[4] => 1973
[5] => 1886
)
[UF_SELECT_SAT] => Array
(
[0] => 1880
[1] => 1845
[2] => 1941
)
[UF_SELECT_SUN] => Array
(
[0] => 1845
[1] => 1995
[2] => 1971
[3] => 1937
[4] => 1855
[5] => 1852
[6] => 1871
[7] => 1929
[8] => 1974
[9] => 1903
[10] => 1870
[11] => 1975
[12] => 1966
)
[UF_ADDRESS] => 1373
)
...
0] => Array
(
[NAME] => Иванов
[LAST_NAME] => Иван
[UF_SELECT_MON] => Array
(
[0] => Элемент 1
[1] => Элемент 2
...
)
...
button onclick="submitOrder(form); return false;"
Функция висит на кнопке. Все работает если убрать скрипт события