if ($_POST[$action_var] == "recalculate") { // todo: extract duplicated code to function CBitrixComponent::includeComponentClass("redvent:sale.basket.basket"); $basket = new CRedventBasketComponent(); $basket->onIncludeComponentLang(); $basket->weightKoef = htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, SITE_ID)); $basket->weightUnit = htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', "", SITE_ID)); $basket->columns = $arColumns; $basket->offersProps = $strOffersProps; $basket->quantityFloat = isset($_POST["quantity_float"]) && $_POST["quantity_float"] == "Y" ? "Y" : "N"; $basket->countDiscount4AllQuantity = isset($_POST["count_discount_4_all_quantity"]) && $_POST["count_discount_4_all_quantity"] == "Y" ? "Y" : "N"; $basket->priceVatShowValue = isset($_POST["price_vat_show_value"]) && $_POST["price_vat_show_value"] == "Y" ? "Y" : "N"; $basket->hideCoupon = isset($_POST["hide_coupon"]) && $_POST["hide_coupon"] == "Y" ? "Y" : "N"; $basket->usePrepayment = isset($_POST["use_prepayment"]) && $_POST["use_prepayment"] == "Y" ? "Y" : "N"; $res = $basket->recalculateBasket($_POST); foreach ($res as $key => $value) { $arRes[$key] = $value; } $arRes["BASKET_DATA"] = $basket->getBasketItems(); $arRes["BASKET_DATA"]["GRID"]["HEADERS"] = $basket->getCustomColumns(); $arRes["COLUMNS"] = $strColumns; $arRes["CODE"] = "SUCCESS"; } } } $arRes["PARAMS"]["QUANTITY_FLOAT"] = isset($_POST["quantity_float"]) && $_POST["quantity_float"] == "Y" ? "Y" : "N"; //_show_array($arRes); $APPLICATION->RestartBuffer(); header('Content-Type: application/json; charset=' . LANG_CHARSET); echo CUtil::PhpToJSObject($arRes); die;