Current Path : /home/bitrix/ext_www/dev.klimatlend.ua/ |
Current File : /home/bitrix/ext_www/dev.klimatlend.ua/rm4basket.php |
<?php require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php'); CModule::IncludeModule("iblock"); CModule::IncludeModule("sale"); CModule::IncludeModule("catalog"); if ($_SESSION["PRIVATBANK_PAYTYPE"] != "" || $_SESSION["PRIVATBANK_PAY_PERIOD"] !="" || $_SESSION["PRIVATBANK_PAY_PRICE"]!=""){ $products_ids = array(); $basket = \Bitrix\Sale\Basket::loadItemsForFUser( \Bitrix\Sale\Fuser::getId(), \Bitrix\Main\Context::getCurrent()->getSite() ); foreach ($basket as $basketItem) { $products_ids[] = array("ID" => $basketItem->getProductId(), "Q"=>$basketItem->getQuantity()); } unset($_SESSION["PRIVATBANK_PAYTYPE"]); unset($_SESSION["PRIVATBANK_PAY_PERIOD"]); unset($_SESSION["PRIVATBANK_PAY_PRICE"]); unset($_SESSION["PRIVATBANK_KREDIT3"]); // pre1($products_ids); foreach ($basket as $basketItem) { $basketItem->delete(); // Удаление } $basket->save(); foreach ($products_ids as $product){ Add2BasketByProductID($product["ID"], $product["Q"]); } } //echo SITE_ID; if(!isset($_POST['quantity'])) Add2BasketByProductID($_POST["item"], 1); else{ $arFields = array( "QUANTITY" => 0 ); CSaleBasket::Update($_POST["item"], $arFields); } $APPLICATION->IncludeComponent( "bitrix:sale.basket.basket.small", "head", array( "COMPONENT_TEMPLATE" => "head", "PATH_TO_BASKET" => "/personal/cart/", "PATH_TO_ORDER" => "/personal/order/make/", "SHOW_DELAY" => "N", "SHOW_NOTAVAIL" => "N", "SHOW_SUBSCRIBE" => "N" ), false );