Пример #1
0
                 $arRes["BASKET_ID"] = $arItem['ID'];
             }
             $arRes["CODE"] = $bBasketUpdate === true ? "SUCCESS" : "ERROR";
             if ($bBasketUpdate === false && is_array($arErrors) && !empty($arErrors)) {
                 foreach ($arErrors as $error) {
                     $arRes["MESSAGE"] .= (strlen($arRes["MESSAGE"]) > 0 ? "<br/>" : "") . $error;
                 }
             }
         }
     }
 } else {
     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();