本文整理汇总了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);
}
}
示例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;
}