当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleBasket::Delete方法代码示例

本文整理汇总了PHP中CSaleBasket::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasket::Delete方法的具体用法?PHP CSaleBasket::Delete怎么用?PHP CSaleBasket::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleBasket的用法示例。


在下文中一共展示了CSaleBasket::Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TransferBasket

 function TransferBasket($FROM_FUSER_ID, $TO_FUSER_ID)
 {
     $FROM_FUSER_ID = (int) $FROM_FUSER_ID;
     $TO_FUSER_ID = (int) $TO_FUSER_ID;
     if ($TO_FUSER_ID > 0 && $FROM_FUSER_ID > 0) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID] = 0;
         $dbTmp = CSaleUser::GetList(array("ID" => $TO_FUSER_ID));
         if (!empty($dbTmp)) {
             $arOldBasket = array();
             $dbBasket = CSaleBasket::GetList(array(), array("FUSER_ID" => $TO_FUSER_ID, "ORDER_ID" => false));
             while ($arBasket = $dbBasket->Fetch()) {
                 $arOldBasket[$arBasket["PRODUCT_ID"]] = $arBasket;
                 $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]++;
             }
             $dbBasket = CSaleBasket::GetList(array(), array("FUSER_ID" => $FROM_FUSER_ID, "ORDER_ID" => false));
             while ($arBasket = $dbBasket->Fetch()) {
                 $arUpdate = array("FUSER_ID" => $TO_FUSER_ID);
                 if (!empty($arOldBasket[$arBasket["PRODUCT_ID"]])) {
                     $arUpdate["QUANTITY"] = $arBasket["QUANTITY"] + $arOldBasket[$arBasket["PRODUCT_ID"]]["QUANTITY"];
                     CSaleBasket::Delete($arBasket["ID"]);
                     CSaleBasket::_Update($arOldBasket[$arBasket["PRODUCT_ID"]]["ID"], $arUpdate);
                 } else {
                     $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]++;
                     CSaleBasket::_Update($arBasket["ID"], $arUpdate);
                 }
             }
             return true;
         }
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:basket.php

示例2: array

        $arProps[] = array("NAME" => "Версия", "CODE" => "HL_VersionB", "VALUE" => $HL_VersionB);
        $arProps[] = array("NAME" => "Цена за копию", "CODE" => "OneSumB", "VALUE" => $OneSumB);
        $arProps[] = array("NAME" => "Всего - цена", "CODE" => "AllSumB", "VALUE" => $AllSumB);
        $arFields["PROPS"] = $arProps;
        CSaleBasket::Add($arFields);
    }
}
?>



<?php 
//удаления из корзины
if (CModule::IncludeModule("sale")) {
    if (sest::checkGET('product_id_cart_del')) {
        CSaleBasket::Delete($_GET['product_id_cart_del']);
    }
}
?>



<?php 
//оформляю заказ
if (CModule::IncludeModule("sale")) {
    if (sest::checkGET('totalSum') && sest::checkGET('makeOrder')) {
        $totalSum = $_GET['totalSum'];
        $makeOrder = $_GET['makeOrder'];
        $productsStr = $_GET['products'][0];
        $arrProd = explode('/', $productsStr);
        $arrCleanProducts = array();
开发者ID:VitaliiSestrenskyi,项目名称:make_offers,代码行数:31,代码来源:ajax.php

示例3: str_replace

                 }
             }
             if (!$res) {
                 if ($ex = $APPLICATION->GetException()) {
                     $errorMessage .= $ex->GetString();
                 } else {
                     $errorMessage .= str_replace("#ID#", $arBasketList[$i][$j]["PRODUCT_ID"], GetMessage("SOE_ERROR_SAVE_ITEM")) . ". ";
                 }
             }
         }
     }
     foreach ($arOldBasketList as $key => $value) {
         if (strlen($value["CANCEL_CALLBACK_FUNC"]) > 0) {
             $arFields = CSaleBasket::ExecuteCallbackFunction($value["CANCEL_CALLBACK_FUNC"], $value["MODULE"], $value["PRODUCT_ID"], $value["QUANTITY"], true);
         }
         CSaleBasket::Delete($key);
     }
 }
 if (strlen($errorMessage) <= 0) {
     $arOldTaxList = array();
     $dbTax = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $ID), false, false, array("*"));
     while ($arTax = $dbTax->Fetch()) {
         $arOldTaxList[IntVal($arTax["ID"])] = "Y";
     }
     for ($i = 0; $i < count($arIDs); $i++) {
         for ($j = 0; $j < count($arTaxList); $j++) {
             $arFields = array("ORDER_ID" => $arIDs[$i], "TAX_NAME" => $arTaxList[$j]["TAX_NAME"], "VALUE" => $arTaxList[$j]["VALUE"], "VALUE_MONEY" => $arOrderTaxList[$i][$j]["VALUE_MONEY"], "APPLY_ORDER" => $arTaxList[$j]["APPLY_ORDER"], "IS_PERCENT" => "Y", "IS_IN_PRICE" => $arTaxList[$j]["IS_IN_PRICE"], "CODE" => $arTaxList[$j]["CODE"]);
             $res = False;
             if ($arTaxList[$j]["ID"] > 0) {
                 if (array_key_exists($arTaxList[$j]["ID"], $arOldTaxList)) {
                     $res = CSaleOrderTax::Update($arTaxList[$j]["ID"], $arFields);
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:order_edit.php

示例4: _Delete

 function _Delete($ID)
 {
     global $DB;
     $ID = IntVal($ID);
     $bSuccess = True;
     foreach (GetModuleEvents("sale", "OnBeforeOrderDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     $DB->StartTransaction();
     if ($bSuccess) {
         $dbBasket = CSaleBasket::GetList(array(), array("ORDER_ID" => $ID));
         while ($arBasket = $dbBasket->Fetch()) {
             $bSuccess = CSaleBasket::Delete($arBasket["ID"]);
             if (!$bSuccess) {
                 break;
             }
         }
     }
     if ($bSuccess) {
         $dbRecurring = CSaleRecurring::GetList(array(), array("ORDER_ID" => $ID));
         while ($arRecurring = $dbRecurring->Fetch()) {
             $bSuccess = CSaleRecurring::Delete($arRecurring["ID"]);
             if (!$bSuccess) {
                 break;
             }
         }
     }
     if ($bSuccess) {
         $bSuccess = CSaleOrderPropsValue::DeleteByOrder($ID);
     }
     if ($bSuccess) {
         $bSuccess = CSaleOrderTax::DeleteEx($ID);
     }
     if ($bSuccess) {
         $bSuccess = CSaleUserTransact::DeleteByOrder($ID);
     }
     if ($bSuccess) {
         unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
     }
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sale_order WHERE ID = " . $ID . "", true);
     }
     if ($bSuccess) {
         $DB->Commit();
     } else {
         $DB->Rollback();
     }
     foreach (GetModuleEvents("sale", "OnOrderDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $bSuccess));
     }
     return $bSuccess;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:54,代码来源:order.php

示例5: unset

unset($arResult["GRID"]["HEADERS"][8]);
$some_products_are_in_favourite = false;
//flag to check favourites
foreach ($arResult["GRID"]["ROWS"] as $k => $arItem) {
    if (CModule::IncludeModule('iblock') && CModule::IncludeModule('sale')) {
        /***/
        if ($arItem['DELAY'] == 'Y') {
            $some_products_are_in_favourite = true;
            //set flag to true
            unset($arResult["GRID"]["ROWS"][$k]);
            //unset from array this item
            continue;
            //begin new cycle point
        }
        if ($arItem['CAN_BUY'] == 'N') {
            CSaleBasket::Delete($arItem['ID']);
        }
        //delete product from basket, if we cannot buy it!
        /***/
        $bres = CCatalogSku::GetProductInfo($arItem['PRODUCT_ID']);
        if ($bres['ID'] > 0) {
            $idToSearch = $bres['ID'];
        } else {
            $idToSearch = $arItem['PRODUCT_ID'];
        }
        $arResult["GRID"]["ROWS"][$k]['realid'] = $idToSearch;
        $res = CIBlockElement::GetByID($idToSearch);
        $tovar = $res->GetNext();
        $arResult["GRID"]["ROWS"][$k]['DETAIL_PAGE_URL'] = $tovar['DETAIL_PAGE_URL'];
    }
    if ($arItem["PREVIEW_PICTURE"] || $arItem['DETAIL_PICTURE'] || $arItem['PROPERTY_MORE_PHOTO_VALUE']) {
开发者ID:Andreyjktl,项目名称:kidster,代码行数:31,代码来源:result_modifier.php

示例6: GetMessage

 if ($arResult['REQUEST_AMOUNT'] <= 0 || $arResult['REQUEST_ACCOUNT'] == '') {
     $arResult['ERROR'] = GetMessage('SPT_ERROR_REQUIRED_AMOUNT');
 }
 if ($arResult['ERROR'] == '' && !isset($arResult['ACCOUNT'][$arResult['REQUEST_ACCOUNT']])) {
     $arResult['ERROR'] = GetMessage('SPT_ERROR_CURR');
 }
 if ($arParams['PAY_IMMED'] && (!$arResult['REQUEST_PAY_SYSTEM'] || !isset($arResult['PAY_SYSTEMS'][$arResult['REQUEST_PAY_SYSTEM']]))) {
     $arResult['ERROR'] = GetMessage('SPT_ERROR_PAY_SYSTEM');
 }
 if ($arResult['ERROR'] == '') {
     $dbBaket = CSaleBasket::GetList(array(), array('FUSER_ID' => CSaleBasket::GetBasketUserID(), 'LID' => SITE_ID, 'ORDER_ID' => 'NULL'));
     while ($arBasket = $dbBaket->GetNext()) {
         if ($arBasket['CATALOG_XML_ID'] != '' && strpos($arBasket['CATALOG_XML_ID'], '@') !== false) {
             list($amount, $curr) = explode('@', $arBasket['CATALOG_XML_ID']);
             if ($curr == $arResult['REQUEST_ACCOUNT']) {
                 CSaleBasket::Delete($arBasket['ID']);
             }
         }
     }
     if ($arParams['PAY_IMMED']) {
         CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
     }
     CSaleBasket::Add(array('PRODUCT_ID' => $arResult['CURRENCIES'][$arResult['REQUEST_ACCOUNT']]['ID'], 'PRICE' => CCurrencyRates::ConvertCurrency($arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], $arResult['LANG_CURRENCY']), 'CURRENCY' => $arResult['LANG_CURRENCY'], 'QUANTITY' => 1, 'LID' => LANG, 'DELAY' => 'N', 'CAN_BUY' => 'Y', 'NAME' => GetMessage('SPT_NAME_IN_CART', array('#VALUE#' => SaleFormatCurrency($arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT']))), 'MODULE' => 'asd.money', 'DETAIL_PAGE_URL' => '', 'CATALOG_XML_ID' => $arResult['REQUEST_AMOUNT'] . '@' . $arResult['REQUEST_ACCOUNT']));
     if ($arParams['PAY_IMMED']) {
         $ORDER_ID = CSaleOrder::Add(array('LID' => SITE_ID, 'PERSON_TYPE_ID' => $arParams['PERSON_TYPE'], 'PRICE' => CCurrencyRates::ConvertCurrency($arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], $arResult['LANG_CURRENCY']), 'CURRENCY' => $arResult['LANG_CURRENCY'], 'PAY_SYSTEM_ID' => $arResult['REQUEST_PAY_SYSTEM'], 'USER_ID' => $USER->getID()));
         if ($ORDER_ID > 0) {
             $arOrder = CSaleOrder::GetByID($ORDER_ID);
             CSaleBasket::OrderBasket($ORDER_ID);
         }
         $arPaySysAction = $arResult['PAY_SYSTEMS'][$arResult['REQUEST_PAY_SYSTEM']];
         if (strlen($arPaySysAction['ACTION_FILE']) > 0) {
开发者ID:Hawkart,项目名称:megatv,代码行数:31,代码来源:component.php

示例7: nodeHandler

 function nodeHandler(CDataXML $value)
 {
     $value = $value->GetArray();
     $value = $value[GetMessage("CC_BSC1_DOCUMENT")];
     if ($value["#"][GetMessage("CC_BSC1_OPERATION")][0]["#"] == GetMessage("CC_BSC1_ORDER")) {
         $orderId = IntVal($value["#"][GetMessage("CC_BSC1_NUMBER")][0]["#"]);
         $arOrder = array();
         $arItem = array();
         $arOrder["AMOUNT"] = $value["#"][GetMessage("CC_BSC1_SUMM")][0]["#"];
         $arOrder["AMOUNT"] = str_replace($SumFormat, ".", $arOrder["AMOUNT"]);
         $arOrder["COMMENT"] = $value["#"][GetMessage("CC_BSC1_COMMENT")][0]["#"];
         foreach ($value["#"][GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")] as $val) {
             $arOrder["TRAITS"][$val["#"][GetMessage("CC_BSC1_NAME")][0]["#"]] = $val["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
         }
         $taxValue = 0;
         $taxValueTmp = 0;
         $taxName = "";
         if (is_array($value["#"][GetMessage("CC_BSC1_ITEMS")][0]["#"][GetMessage("CC_BSC1_ITEM")])) {
             foreach ($value["#"][GetMessage("CC_BSC1_ITEMS")][0]["#"][GetMessage("CC_BSC1_ITEM")] as $val) {
                 $val = $val["#"];
                 $productID = $val[GetMessage("CC_BSC1_ID")][0]["#"];
                 $bGood = false;
                 $discountPrice = "";
                 $priceAll = str_replace($SumFormat, ".", $val[GetMessage("CC_BSC1_SUMM")][0]["#"]);
                 $priceone = str_replace($SumFormat, ".", $val[GetMessage("CC_BSC1_PRICE_PER_UNIT")][0]["#"]);
                 $quantity = str_replace($QuantityFormat, ".", $val[GetMessage("CC_BSC1_QUANTITY")][0]["#"]);
                 $price = $priceAll / $quantity;
                 if ($priceone != $price) {
                     $discountPrice = $priceone - $price;
                 }
                 //DISCOUNTS!
                 $arItem[$productID] = array("NAME" => $val[GetMessage("CC_BSC1_NAME")][0]["#"], "PRICE" => $price, "QUANTITY" => $quantity, "DISCOUNT_PRICE" => $discountPrice);
                 if (is_array($val[GetMessage("CC_BSC1_PROPS_ITEMS")][0]["#"][GetMessage("CC_BSC1_PROP_ITEM")])) {
                     foreach ($val[GetMessage("CC_BSC1_PROPS_ITEMS")][0]["#"][GetMessage("CC_BSC1_PROP_ITEM")] as $val1) {
                         $arItem[$productID]["ATTRIBUTES"][$val1["#"][GetMessage("CC_BSC1_NAME")][0]["#"]] = $val1["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
                     }
                 }
                 if (is_array($val[GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")])) {
                     foreach ($val[GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")] as $val1) {
                         if ($val1["#"][GetMessage("CC_BSC1_NAME")][0]["#"] == GetMessage("CC_BSC1_ITEM_TYPE")) {
                             $arItem[$productID]["TYPE"] = $val1["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
                         }
                     }
                 }
                 if (strlen($value["#"][GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_NAME")][0]["#"]) > 0) {
                     $taxValueTmp = $val[GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_TAX_VALUE")][0]["#"];
                     $arItem[$productID]["VAT_RATE"] = $taxValueTmp / 100;
                     if (IntVal($taxValueTmp) > IntVal($taxValue)) {
                         $taxName = $val[GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_NAME")][0]["#"];
                         $taxValue = $taxValueTmp;
                     }
                 }
             }
         }
         if (IntVal($taxValue) > 0) {
             $price = str_replace($SumFormat, ".", $value["#"][GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_SUMM")][0]["#"]);
             $arOrder["TAX"] = array("NAME" => $taxName, "VALUE" => $taxValue, "IS_IN_PRICE" => $value["#"][GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_IN_PRICE")][0]["#"] == "true" ? "Y" : "N", "VALUE_MONEY" => $price);
         }
         $arOrder["items"] = $arItem;
         $v = $arOrder;
         if ($orderInfo = CSaleOrder::GetByID($orderId)) {
             if ($orderInfo["PAYED"] != "Y" && $orderInfo["ALLOW_DELIVERY"] != "Y" && $orderInfo["STATUS_ID"] != "F") {
                 $dbOrderTax = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $orderId), false, false, array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE"));
                 $bTaxFound = false;
                 if ($arOrderTax = $dbOrderTax->Fetch()) {
                     $bTaxFound = true;
                     if (IntVal($arOrderTax["VALUE_MONEY"]) != IntVal($v["TAX"]["VALUE_MONEY"]) || IntVal($arOrderTax["VALUE"]) != IntVal($v["TAX"]["VALUE"]) || $arOrderTax["IS_IN_PRICE"] != $v["TAX"]["IS_IN_PRICE"]) {
                         if (IntVal($v["TAX"]["VALUE"]) > 0) {
                             $arFields = array("TAX_NAME" => $v["TAX"]["NAME"], "ORDER_ID" => $orderId, "VALUE" => $v["TAX"]["VALUE"], "IS_PERCENT" => "Y", "IS_IN_PRICE" => $v["TAX"]["IS_IN_PRICE"], "VALUE_MONEY" => $v["TAX"]["VALUE_MONEY"], "CODE" => "VAT1C", "APPLY_ORDER" => "100");
                             CSaleOrderTax::Update($arOrderTax["ID"], $arFields);
                             CSaleOrder::Update($orderId, array("TAX_VALUE" => $v["TAX"]["VALUE_MONEY"]));
                         } else {
                             CSaleOrderTax::Delete($arOrderTax["ID"]);
                             CSaleOrder::Update($orderId, array("TAX_VALUE" => 0));
                         }
                     }
                 }
                 if (!$bTaxFound) {
                     if (IntVal($v["TAX"]["VALUE"]) > 0) {
                         $arFields = array("TAX_NAME" => $v["TAX"]["NAME"], "ORDER_ID" => $orderId, "VALUE" => $v["TAX"]["VALUE"], "IS_PERCENT" => "Y", "IS_IN_PRICE" => $v["TAX"]["IS_IN_PRICE"], "VALUE_MONEY" => $v["TAX"]["VALUE_MONEY"]);
                         CSaleOrderTax::Add($arFields);
                         CSaleOrder::Update($orderId, array("TAX_VALUE" => $v["TAX"]["VALUE_MONEY"]));
                     }
                 }
                 $dbBasket = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $orderId));
                 $basketSum = 0;
                 while ($arBasket = $dbBasket->Fetch()) {
                     $arFields = array();
                     if (!empty($v["items"][$arBasket["PRODUCT_XML_ID"]])) {
                         if ($arBasket["QUANTITY"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["QUANTITY"]) {
                             $arFields["QUANTITY"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["QUANTITY"];
                         }
                         if ($arBasket["PRICE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["PRICE"]) {
                             $arFields["PRICE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["PRICE"];
                         }
                         if ($arBasket["VAT_RATE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["VAT_RATE"]) {
                             $arFields["VAT_RATE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["VAT_RATE"];
                         }
                         if ($arBasket["DISCOUNT_PRICE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["DISCOUNT_PRICE"]) {
                             $arFields["DISCOUNT_PRICE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["DISCOUNT_PRICE"];
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:component.php

示例8: array

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("sale");
if (isset($_GET['delete_from_basket'])) {
    CSaleBasket::Delete(intval($_GET['delete_from_basket']));
}
if (isset($_GET['update_basket_item']) && isset($_GET['basket_item_quantity'])) {
    CSaleBasket::Update(intval($_GET['update_basket_item']), array("QUANTITY" => intval($_GET['basket_item_quantity'])));
}
$APPLICATION->IncludeComponent("bitrix:sale.basket.basket", "ajax", array("COLUMNS_LIST" => array(0 => "TYPE"), "PATH_TO_ORDER" => "/personal/order.php", "HIDE_COUPON" => "N", "PRICE_VAT_SHOW_VALUE" => "N", "COUNT_DISCOUNT_4_ALL_QUANTITY" => "N", "USE_PREPAYMENT" => "N", "QUANTITY_FLOAT" => "N", "SET_TITLE" => "Y", "ACTION_VARIABLE" => "action", "OFFERS_PROPS" => ""), false);
开发者ID:ASDAFF,项目名称:mp,代码行数:11,代码来源:index.php

示例9: recalculateBasket

	public function recalculateBasket($arPost)
	{
		global $USER;
		$arRes = array();

		if ($this->hideCoupon != "Y")
		{
			if (isset($arPost["coupon"]) && !empty($arPost["coupon"]))
			{
				$arRes["VALID_COUPON"] = CCatalogDiscountCoupon::SetCoupon($arPost["coupon"]);
			}

			if (!isset($arRes["VALID_COUPON"]) || (isset($arRes["VALID_COUPON"]) && $arRes["VALID_COUPON"] === false))
			{
				CCatalogDiscountCoupon::ClearCoupon();
			}
		}

		$arTmpItems = array();
		$dbItems = CSaleBasket::GetList(
			array("PRICE" => "DESC"),
			array(
				"FUSER_ID" => CSaleBasket::GetBasketUserID(),
				"LID" => SITE_ID,
				"ORDER_ID" => "NULL"
			),
			false,
			false,
			array(
				"ID", "NAME", "PRODUCT_PROVIDER_CLASS", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID",
				"QUANTITY", "DELAY", "CAN_BUY", "CURRENCY", "SUBSCRIBE", "TYPE", "SET_PARENT_ID", "NOTES"
			)
		);
		while ($arItem = $dbItems->Fetch())
		{
			if (CSaleBasketHelper::isSetItem($arItem))
				continue;

			$arTmpItems[] = $arItem;
		}

		if (!empty($arTmpItems) && CModule::IncludeModule("catalog"))
			$arTmpItems = getRatio($arTmpItems);

		foreach ($arTmpItems as $arItem)
		{
			$isFloatQuantity = ((isset($arItem["MEASURE_RATIO"]) && floatval($arItem["MEASURE_RATIO"]) > 0 && $arItem["MEASURE_RATIO"] != 1)
				|| $this->quantityFloat == "Y") ? true : false;

			if (!isset($arPost["QUANTITY_".$arItem["ID"]]) || floatval($arPost["QUANTITY_".$arItem["ID"]]) <= 0)
			{
				$quantityTmp = ($isFloatQuantity === true) ? floatval($arItem["QUANTITY"]) : intval($arItem["QUANTITY"]);
			}
			else
			{
				$quantityTmp = ($isFloatQuantity === true) ? floatval($arPost["QUANTITY_".$arItem["ID"]]) : intval($arPost["QUANTITY_".$arItem["ID"]]);
			}

			$deleteTmp = ($arPost["DELETE_".$arItem["ID"]] == "Y") ? "Y" : "N";
			$delayTmp = ($arPost["DELAY_".$arItem["ID"]] == "Y") ? "Y" : "N";

			if ($arItem["CAN_BUY"] == "Y")
			{
				$res = $this->checkQuantity($arItem, $quantityTmp);

				if (!empty($res))
					$arRes["WARNING_MESSAGE"][] = $res["ERROR"];
			}

			if ($deleteTmp == "Y" && in_array("DELETE", $this->columns))
			{
				if ($arItem["SUBSCRIBE"] == "Y" && is_array($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()]))
					unset($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()][$arItem["PRODUCT_ID"]]);

				CSaleBasket::Delete($arItem["ID"]);
			}
			elseif ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y")
			{
				unset($arFields);
				$arFields = array();

				if (in_array("QUANTITY", $this->columns))
					$arFields["QUANTITY"] = $quantityTmp;
				if (in_array("DELAY", $this->columns))
					$arFields["DELAY"] = $delayTmp;

				if (count($arFields) > 0
					&&
						($arItem["QUANTITY"] != $arFields["QUANTITY"] && in_array("QUANTITY", $this->columns)
							|| $arItem["DELAY"] != $arFields["DELAY"] && in_array("DELAY", $this->columns))
					)
					CSaleBasket::Update($arItem["ID"], $arFields);
			}
			elseif ($arItem["DELAY"] == "Y" && $arItem["CAN_BUY"] == "Y")
			{
				unset($arFields);
				$arFields = array();

				if (in_array("DELAY", $this->columns))
					$arFields["DELAY"] = $delayTmp;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:class.php

示例10: Delete

 /**
  * <p>Метод удаляет запись корзины с кодом ID. Метод динамичный.</p> <a name="examples"></a>
  *
  *
  * @param int $ID  
  *
  * @return bool 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * if (CSaleBasket::Delete(22))
  *     echo "Запись успешно удалена";
  * ?&gt;
  * </htmМетод может использоваться и для удаления записей корзин, которые уже превращены в заказы. То есть, мы можем удалить запись из состава заказа. Но следует помнить, что после использования метода необходимо обновлять итоговую сумму заказа, например, так: 
  * 
  * 
  *  $contents = array();
  *  $dbBasketItems = CSaleBasket::GetList(
  *             array(
  *                "NAME" =&gt; "ASC",
  *                "ID" =&gt; "ASC"
  *             ),
  *             array(
  *               "LID" =&gt; SITE_ID,
  *               "ORDER_ID" =&gt; $order_id,
  *             )
  *          );
  *   while ($arItems = $dbBasketItems-&gt;Fetch()){
  *             $contents[] = $arItems;
  *          }
  *   $sum = 0;
  *   foreach($contents as $basket_item){
  *             if($basket_item['DISCOUNT_PRICE']&gt;0){
  *                $sum += $basket_item['DISCOUNT_PRICE']*$basket_item['QUANTITY'];
  *             }else{
  *                $sum += $basket_item['PRICE']*$basket_item['QUANTITY'];
  *             }
  *          }
  *    $arFields = array(
  *             "PRICE" =&gt; $sum,
  *          );
  *    CSaleOrder::Update($order_id, $arFields);
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalebasket/csalebasket__delete.e0d06223.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     global $DB, $APPLICATION;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     if ($isOrderConverted == "Y") {
         /** @var \Bitrix\Sale\Result $r */
         $r = \Bitrix\Sale\Compatible\BasketCompatibility::delete($ID);
         if (!$r->isSuccess(true)) {
             foreach ($r->getErrorMessages() as $error) {
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
         return true;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:basket.php

示例11: array

<?php

//edit order
$mode = $request->getPost('mode');
if ($mode == 'deleteItemBasketOrder') {
    $orderid = $request->getPost('orderid');
    $prodbsid = $request->getPost('prodbsid');
    $productid = $request->getPost('productid');
    if (isset($orderid) && !empty($orderid) && isset($prodbsid) && !empty($prodbsid) && isset($productid) && !empty($productid)) {
        CSaleBasket::Delete($prodbsid);
        $contents = array();
        $dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("ORDER_ID" => $orderid));
        while ($arItems = $dbBasketItems->Fetch()) {
            $contents[] = $arItems;
        }
        $sum = 0;
        foreach ($contents as $basket_item) {
            if ($basket_item['DISCOUNT_PRICE'] > 0) {
                $sum += $basket_item['DISCOUNT_PRICE'] * $basket_item['QUANTITY'];
            } else {
                $sum += $basket_item['PRICE'] * $basket_item['QUANTITY'];
            }
        }
        $arFields = array("PRICE" => $sum);
        $resUpdate = CSaleOrder::Update($orderid, $arFields);
        echo $resUpdate;
    } else {
        throw new SystemException('Error with deleting products');
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:30,代码来源:DeleteUpdateBasketItem.php

示例12: foreach

    foreach ($arResult["GRID"]["ROWS"][$k]["OPTIONS"] as $id => $ar) {
        foreach ($ar as $k2 => $arOptions) {
            if (is_array($basketOptions[$arItem["PRODUCT_ID"]][$arOptions["ID"]])) {
                $arResult["GRID"]["ROWS"][$k]["OPTIONS"][$id][$k2]["IN_BASKET"] = "Y";
            } else {
                $arResult["GRID"]["ROWS"][$k]["OPTIONS"][$id][$k2]["IN_BASKET"] = "N";
            }
        }
    }
}
//Если в корзине остались опции, но при этом проект удалён \ снят с продажи
$need_reload = false;
foreach ($basketOptions as $project_id => $ar) {
    if (!isset($basketProduct[$project_id])) {
        foreach ($ar as $item) {
            CSaleBasket::Delete($item["ID"]);
        }
        $need_reload = true;
    }
}
if ($need_reload) {
    header("Location: ?reload=Y");
    die;
}
//$arResult["allSum"]	=	0;
foreach ($arResult["ITEMS"]["AnDelCanBuy"] as $k => $arItem) {
    if ($arItem["MODULE"] == "bq.options") {
        unset($arResult["ITEMS"]["AnDelCanBuy"][$k]);
        continue;
    }
    $arResult["allSum"] += $arItem["PRICE"];
开发者ID:bquadro,项目名称:Projects,代码行数:31,代码来源:result_modifier.php

示例13: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
     }
     foreach (GetModuleEvents("sale", "OnBasketDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:44,代码来源:basket.php

示例14: intval

        if ($action == "ADD2BASKET") {
            $PRODUCT_ID = intval($_GET["id"]);
            $QUANTITY = intval($_GET["QUANTITY"]);
            if ($action == "ADD2BASKET" && intval($PRODUCT_ID) > 0 && intval($QUANTITY) > 0) {
                $arPropItem = getItemCart($arItem["PRODUCT_ID"]);
                $arProps = array();
                $arProps = array(array("NAME" => "Артикул", "CODE" => "ARTIKUL", "VALUE" => $arPropItem["PROPERTY_ARTIKUL_VALUE"], "SORT" => 100), array("NAME" => "Наличие", "CODE" => "DEPOSIT", "VALUE" => $arPropItem["CATALOG_PROP"]["QUANTITY"] < 2 ? "N" : "Y", "SORT" => 200));
                if (!Add2BasketByProductID($PRODUCT_ID, $QUANTITY, array(), $arProps)) {
                    exit;
                }
            }
        } elseif ($action == "UPDATE2BASKET") {
            if (is_array($_GET["items"])) {
                foreach ($_GET["items"] as $key => $arItems) {
                    $PRODUCT_ID = intval($arItems["id"]);
                    $QUANTITY = intval($arItems["count"]);
                    $arFields = array("QUANTITY" => $QUANTITY);
                    if (!CSaleBasket::Update($PRODUCT_ID, $arFields)) {
                        exit;
                    }
                }
            }
        } elseif ($action == "DEL2BASKET") {
            $DELETE = intval($_GET["id"]);
            if (!CSaleBasket::Delete($DELETE)) {
                exit;
            }
        }
    }
    $APPLICATION->IncludeComponent("bitrix:sale.basket.basket.small", "footer_cart", array("PATH_TO_BASKET" => "/personal/cart/", "PATH_TO_ORDER" => "/personal/order/make/", "SHOW_DELAY" => "Y", "SHOW_NOTAVAIL" => "Y", "SHOW_SUBSCRIBE" => "Y"));
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:basket_small.php

示例15: removeItemFromCart

 protected function removeItemFromCart()
 {
     if (preg_match('/^[0-9]+$/', $_POST["sbblRemoveItemFromCart"]) !== 1) {
         return;
     }
     if (!($userFilter = $this->getUserFilter())) {
         return;
     }
     $numProducts = CSaleBasket::GetList(array(), $userFilter + array("ID" => $_POST['sbblRemoveItemFromCart']), array());
     if ($numProducts > 0) {
         CSaleBasket::Delete($_POST['sbblRemoveItemFromCart']);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:class.php


注:本文中的CSaleBasket::Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。