當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCatalogProduct::QuantityTracer方法代碼示例

本文整理匯總了PHP中CCatalogProduct::QuantityTracer方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogProduct::QuantityTracer方法的具體用法?PHP CCatalogProduct::QuantityTracer怎麽用?PHP CCatalogProduct::QuantityTracer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCatalogProduct的用法示例。


在下文中一共展示了CCatalogProduct::QuantityTracer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: CatalogBasketCancelCallback

function CatalogBasketCancelCallback($PRODUCT_ID, $QUANTITY, $bCancel)
{
    $PRODUCT_ID = intval($PRODUCT_ID);
    $QUANTITY = doubleval($QUANTITY);
    $bCancel = $bCancel ? true : false;
    if ($bCancel) {
        CCatalogProduct::QuantityTracer($PRODUCT_ID, -$QUANTITY);
    } else {
        CCatalogProduct::QuantityTracer($PRODUCT_ID, $QUANTITY);
    }
}
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:11,代碼來源:include.php

示例2: CatalogBasketOrderCustomCallback


//.........這裏部分代碼省略.........
	
	//SIGURD: logic change. see mantiss 5036.
	// discount applied to a final price with VAT already included.
	if ($arPrice['PRICE']['VAT_INCLUDED'] == 'N')
	{
		if(DoubleVal($arPrice['PRICE']['VAT_RATE']) > 0)
		{
			$currentPrice *= (1 + $arPrice['PRICE']['VAT_RATE']);
			$arPrice['PRICE']['VAT_INCLUDED'] = 'Y';
		}
	}

	if (isset($arPrice["DISCOUNT"]) && count($arPrice["DISCOUNT"]) > 0)
	{
		if ($arPrice["DISCOUNT"]["VALUE_TYPE"]=="F")
		{
			if ($arPrice["DISCOUNT"]["CURRENCY"] == $arPrice["PRICE"]["CURRENCY"])
				$currentDiscount = $arPrice["DISCOUNT"]["VALUE"];
			else
				$currentDiscount = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT"]["VALUE"], $arPrice["DISCOUNT"]["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
		}
		else
			$currentDiscount = $currentPrice * $arPrice["DISCOUNT"]["VALUE"] / 100.0;

		$currentDiscount = roundEx($currentDiscount, SALE_VALUE_PRECISION);

		if (DoubleVal($arPrice["DISCOUNT"]["MAX_DISCOUNT"]) > 0)
		{
			if ($arPrice["DISCOUNT"]["CURRENCY"] == $baseCurrency)
				$maxDiscount = $arPrice["DISCOUNT"]["MAX_DISCOUNT"];
			else
				$maxDiscount = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT"]["MAX_DISCOUNT"], $arPrice["DISCOUNT"]["CURRENCY"], $arPrice["PRICE"]["CURRENCY"]);
			$maxDiscount = roundEx($maxDiscount, CATALOG_VALUE_PRECISION);

			if ($currentDiscount > $maxDiscount)
				$currentDiscount = $maxDiscount;
		}
		
		$currentPrice = $currentPrice - $currentDiscount;
	}
	
	$arResult = array(
			"PRODUCT_PRICE_ID" => $arPrice["PRICE"]["ID"],
			"PRICE" => $currentPrice,
			"VAT_RATE" => $arPrice['PRICE']['VAT_RATE'],
			"CURRENCY" => $arPrice["PRICE"]["CURRENCY"],
			"QUANTITY" => $quantity,
			"WEIGHT" => 0,
			"NAME" => $arProduct["~NAME"],
			"CAN_BUY" => "Y",
			"NOTES" => $arPrice["PRICE"]["CATALOG_GROUP_NAME"],
			"DISCOUNT_PRICE" => $currentDiscount,
		);
	if(!empty($arPrice["DISCOUNT"]))
	{
		if(strlen($arPrice["DISCOUNT"]["COUPON"])>0)
			$arResult["DISCOUNT_COUPON"] = $arPrice["DISCOUNT"]["COUPON"];
			if($arPrice["DISCOUNT"]["VALUE_TYPE"]=="P")
				$arResult["DISCOUNT_VALUE"] = $arPrice["DISCOUNT"]["VALUE"]."%";
			else
				$arResult["DISCOUNT_VALUE"] = SaleFormatCurrency($arPrice["DISCOUNT"]["VALUE"], $arPrice["DISCOUNT"]["CURRENCY"]);
			$arResult["DISCOUNT_NAME"] = "[".$arPrice["DISCOUNT"]["ID"]."] ".$arPrice["DISCOUNT"]["NAME"];
			
		$dbCoupon = CCatalogDiscountCoupon::GetList(
			array(),
			array("COUPON" => $arPrice["DISCOUNT"]["COUPON"]),
			false,
			false,
			array("ID", "ONE_TIME")
		);
		if ($arCoupon = $dbCoupon->Fetch())
		{
			$arFieldsCoupon = Array("DATE_APPLY" => Date($GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID))));

			if ($arCoupon["ONE_TIME"] == "Y")
			{
				$arFieldsCoupon["ACTIVE"] = "N";

				foreach($_SESSION["CATALOG_USER_COUPONS"] as $k => $v)
				{
					if(trim($v) == trim($arPrice["DISCOUNT"]["COUPON"]))
					{
						unset($_SESSION["CATALOG_USER_COUPONS"][$k]);
						$_SESSION["CATALOG_USER_COUPONS"][$k] == "";
					}
				}
			}

			CCatalogDiscountCoupon::Update($arCoupon["ID"], $arFieldsCoupon);
		}
	}

	if ($arCatalogProduct)
	{
		$arResult["WEIGHT"] = IntVal($arCatalogProduct["WEIGHT"]);
	}
	CCatalogProduct::QuantityTracer($productID, $quantity);
	
	return $arResult;
}
開發者ID:ASDAFF,項目名稱:alba,代碼行數:101,代碼來源:basket.php


注:本文中的CCatalogProduct::QuantityTracer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。