本文整理汇总了PHP中CCatalogDiscount::getUseBasePrice方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::getUseBasePrice方法的具体用法?PHP CCatalogDiscount::getUseBasePrice怎么用?PHP CCatalogDiscount::getUseBasePrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::getUseBasePrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __CalcOnePriority
/**
* @deprecated deprecated since catalog 15.0.0
* @see CCatalogDiscount::applyDiscountList()
* @see CCatalogDiscount::calculatePriorityLevel()
*/
protected static function __CalcOnePriority(&$arDiscounts, &$arResultDiscount, &$arParams)
{
$boolResult = false;
if (isset($arParams['PRICE']) && isset($arParams['CURRENCY'])) {
$arParams['PRICE'] = (double) $arParams['PRICE'];
$arParams['BASE_PRICE'] = (double) $arParams['BASE_PRICE'];
if ($arParams['PRICE'] > 0) {
$dblCurrentPrice = $arParams['PRICE'];
do {
$dblMinPrice = -1;
$strMinKey = -1;
$boolLast = false;
$boolApply = false;
foreach ($arDiscounts as $strDiscountKey => $arOneDiscount) {
$boolDelete = false;
$dblPriceTmp = -1;
switch ($arOneDiscount['VALUE_TYPE']) {
case CCatalogDiscount::TYPE_PERCENT:
$dblTempo = roundEx((CCatalogDiscount::getUseBasePrice() ? $arParams['BASE_PRICE'] : $dblCurrentPrice) * $arOneDiscount['VALUE'] / 100, CATALOG_VALUE_PRECISION);
if (isset($arOneDiscount['DISCOUNT_CONVERT'])) {
if ($dblTempo > $arOneDiscount['DISCOUNT_CONVERT']) {
$dblTempo = $arOneDiscount['DISCOUNT_CONVERT'];
}
}
$dblPriceTmp = $dblCurrentPrice - $dblTempo;
break;
case CCatalogDiscount::TYPE_FIX:
if ($arOneDiscount['DISCOUNT_CONVERT'] > $dblCurrentPrice) {
$boolDelete = true;
} else {
$dblPriceTmp = $dblCurrentPrice - $arOneDiscount['DISCOUNT_CONVERT'];
}
break;
case CCatalogDiscount::TYPE_SALE:
if (!($arOneDiscount['DISCOUNT_CONVERT'] < $dblCurrentPrice)) {
$boolDelete = true;
} else {
$dblPriceTmp = $arOneDiscount['DISCOUNT_CONVERT'];
}
break;
}
if ($boolDelete) {
unset($arDiscounts[$strDiscountKey]);
} else {
if (-1 == $dblMinPrice || $dblMinPrice > $dblPriceTmp) {
$dblMinPrice = $dblPriceTmp;
$strMinKey = $strDiscountKey;
$boolApply = true;
}
}
}
if ($boolApply) {
$dblCurrentPrice = $dblMinPrice;
$arResultDiscount[] = $arDiscounts[$strMinKey];
if ('Y' == $arDiscounts[$strMinKey]['LAST_DISCOUNT']) {
$arDiscounts = array();
$arParams['LAST_DISCOUNT'] = 'Y';
}
unset($arDiscounts[$strMinKey]);
}
} while (!empty($arDiscounts));
if ($boolApply) {
$arParams['PRICE'] = $dblCurrentPrice;
}
$boolResult = true;
}
}
return $boolResult;
}