本文整理汇总了PHP中CCatalogProduct::__CalcDiscSave方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProduct::__CalcDiscSave方法的具体用法?PHP CCatalogProduct::__CalcDiscSave怎么用?PHP CCatalogProduct::__CalcDiscSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogProduct
的用法示例。
在下文中一共展示了CCatalogProduct::__CalcDiscSave方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CountPriceWithDiscount
//.........这里部分代码省略.........
foreach (GetModuleEvents("catalog", "OnCountPriceWithDiscount", true) as $arEvent)
{
$mxResult = ExecuteModuleEventEx($arEvent, array($price, $currency, $arDiscounts));
if (true !== $mxResult)
return $mxResult;
}
if (strlen($currency) <= 0)
return false;
$price = doubleval($price);
if ($price <= 0)
return 0.0;
if (!is_array($arDiscounts) || empty($arDiscounts))
return $price;
$arDiscSave = array();
$arPriceDiscount = array();
$arResultPrice = array(
'PRICE' => $price,
'CURRENCY' => $currency,
);
CCatalogProduct::__PrimaryDiscountFilter($arDiscounts, $arPriceDiscount, $arDiscSave, $arResultPrice);
if (!empty($arPriceDiscount))
{
foreach ($arPriceDiscount as &$arOnePriority)
{
$boolResultPriority = CCatalogProduct::__CalcOnePriority($arOnePriority, $arDiscountApply, $arResultPrice);
if (!$boolResultPriority)
{
return $price;
}
else
{
if (isset($arResultPrice['LAST_DISCOUNT']) && 'Y' == $arResultPrice['LAST_DISCOUNT'])
break;
}
}
if (isset($arOnePriority))
unset($arOnePriority);
}
if (!empty($arDiscSave))
{
switch($strDiscSaveApply)
{
case 'R':
$arDiscSaveResult = array(
'PRICE' => $price,
'CURRENCY' => $currency,
);
$arDiscSaveApply = array();
$boolResultDiscSave = CCatalogProduct::__CalcDiscSave($arDiscSave, $arDiscSaveApply, $arDiscSaveResult);
if (!$boolResultDiscSave)
{
return $price;
}
else
{
if ($arDiscSaveResult['PRICE'] < $arResultPrice['PRICE'])
{
$arResultPrice = $arDiscSaveResult;
$arDiscountApply = $arDiscSaveApply;
}
}
break;
case 'A':
$boolResultDiscSave = CCatalogProduct::__CalcDiscSave($arDiscSave, $arDiscountApply, $arResultPrice);
if (!$boolResultDiscSave)
{
return $price;
}
break;
case 'D':
if (empty($arDiscountApply))
{
$boolResultDiscSave = CCatalogProduct::__CalcDiscSave($arDiscSave, $arDiscountApply, $arResultPrice);
if (!$boolResultDiscSave)
{
return $price;
}
}
break;
}
}
$currentPrice_min = $arResultPrice['PRICE'];
foreach (GetModuleEvents("catalog", "OnCountPriceWithDiscountResult", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, array(&$currentPrice_min))===false)
return false;
}
return $currentPrice_min;
}