*/ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die(); if (isset($_GET['product']) && isset($_GET['quantity'])) { $arProducts = explode(',', $_GET['product']); $arQuantity = explode(',', $_GET['quantity']); $select = array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'ID' => $arProducts, 'ACTIVE' => 'Y', 'GLOBAL_ACTIVE' => 'Y', 'CATALOG_AVAILABLE' => 'Y'); $rows = CIBlockElement::GetList(false, $select, false, array(), array('ID', 'NAME', 'DETAIL_PICTURE', 'DETAIL_PAGE_URL', 'CATALOG_AVAILABLE',)); $amount['BASKET_AMOUNT'] = 0; $amount['ORDER_AMOUNT'] = 0; while ($ob = $rows->GetNextElement()) { $field = $ob->GetFields(); $property = $ob->GetProperties(); $preview = CFile::GetFileArray($field['DETAIL_PICTURE']); $position = array_search($field['ID'], $arProducts); $measure = \Bitrix\Catalog\ProductTable::getCurrentRatioWithMeasure($field['ID']); $arItem = array( 'ID' => $field['ID'], 'NAME' => $field['NAME'], 'PRICE' => CPrice::GetBasePrice($field['ID'])['PRICE'], 'QUANTITY' => $field['CATALOG_QUANTITY'], 'QUANTITY_VALUE' => $arQuantity[$position], 'URL' => $field['DETAIL_PAGE_URL'], 'PREVIEW' => $preview ? $preview['SRC'] : '/local/images/no-image.png', 'AVAILABLE' => $field['CATALOG_AVAILABLE'] == 'Y', 'ARTICLE' => $property['CML2_ARTICLE']['VALUE'], 'MANUFACTURER' => $property['CML2_MANUFACTURER']['VALUE'], 'MEASURE' => $measure ? $measure[$field['ID']]['MEASURE']['SYMBOL_RUS'] : 'шт', 'ORDER' => $field['CATALOG_QUANTITY'] > 0 ? false : true, ); if ($arItem['QUANTITY_VALUE'] > $arItem['QUANTITY']) { $arItem['QUANTITY_VALUE'] = $arItem['QUANTITY_VALUE'] - $arItem['QUANTITY']; $arResult['OUT_STOCK'][] = $arItem; $amount['ORDER_AMOUNT'] += $arItem['QUANTITY_VALUE'] * $arItem['PRICE']; if ($arItem['ORDER'] == false) { $arItem['QUANTITY_VALUE'] = $arItem['QUANTITY']; $arResult['STOCK'][] = $arItem; $amount['BASKET_AMOUNT'] += $arItem['PRICE'] * $arItem['QUANTITY_VALUE']; } } else { $arResult['STOCK'][] = $arItem; $amount['BASKET_AMOUNT'] += $arItem['PRICE'] * $arItem['QUANTITY_VALUE']; } } $arResult['BASKET_AMOUNT'] = CurrencyFormat($amount['BASKET_AMOUNT'], 'RUB'); $arResult['ORDER_AMOUNT'] = CurrencyFormat($amount['ORDER_AMOUNT'], 'RUB'); $arResult['TOTAL_AMOUNT'] = CurrencyFormat($amount['BASKET_AMOUNT'] + $amount['ORDER_AMOUNT'], 'RUB'); } $this->IncludeComponentTemplate();