本文整理汇总了PHP中Discount::getDiscountRateCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Discount::getDiscountRateCount方法的具体用法?PHP Discount::getDiscountRateCount怎么用?PHP Discount::getDiscountRateCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discount
的用法示例。
在下文中一共展示了Discount::getDiscountRateCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_custom_price
/**
* Returns a product price in the active currency, depending on the
* Customer and special offer status.
* @param Customer $objCustomer The Customer, or null
* @param double $price_options The price for Attributes,
* if any, or 0 (zero)
* @param integer $count The number of products, defaults
* to 1 (one)
* @param boolean $ignore_special_offer
* If true, special offers are ignored.
* This is needed to actually determine
* both prices in the products view.
* Defaults to false.
* @return double The price converted to the active
* currency
* @author Reto Kohli <reto.kohli@comvation.com>
*/
function get_custom_price($objCustomer = null, $price_options = 0, $count = 1, $ignore_special_offer = false)
{
$normalPrice = $this->price();
$resellerPrice = $this->resellerprice();
$discountPrice = $this->discountprice();
$discount_active = $this->discount_active();
$groupCountId = $this->group_id();
$groupArticleId = $this->article_id();
$price = $normalPrice;
if (!$ignore_special_offer && $discount_active == 1 && $discountPrice != 0) {
$price = $discountPrice;
} else {
if ($objCustomer && $objCustomer->is_reseller() && $resellerPrice != 0) {
$price = $resellerPrice;
}
}
$price += $price_options;
$rateCustomer = 0;
if ($objCustomer) {
$groupCustomerId = $objCustomer->group_id();
if ($groupCustomerId) {
$rateCustomer = Discount::getDiscountRateCustomer($groupCustomerId, $groupArticleId);
$price -= $price * $rateCustomer * 0.01;
}
}
$rateCount = 0;
if ($count > 0) {
$rateCount = Discount::getDiscountRateCount($groupCountId, $count);
$price -= $price * $rateCount * 0.01;
}
$price = Currency::getCurrencyPrice($price);
return $price;
}
示例2: showDiscountInfo
/**
* Set up the full set of discount information placeholders
* @param integer $groupCustomerId The customer group ID of the current customer
* @param integer $groupArticleId The article group ID of the current article
* @param integer $groupCountId The count discount group ID of the current article
* @param integer $count The number of articles to be used for the count discount
* @static
* @author Reto Kohli <reto.kohli@comvation.com>
*/
static function showDiscountInfo($groupCustomerId, $groupArticleId, $groupCountId, $count)
{
// Pick the unit for this product (count, meter, kilo, ...)
$unit = Discount::getUnit($groupCountId);
if (!empty($unit)) {
self::$objTemplate->setVariable('SHOP_PRODUCT_UNIT', $unit);
}
if ($groupCustomerId > 0) {
$rateCustomer = Discount::getDiscountRateCustomer($groupCustomerId, $groupArticleId);
if ($rateCustomer > 0) {
self::$objTemplate->setVariable(array('SHOP_DISCOUNT_RATE_CUSTOMER' => $rateCustomer));
}
}
if ($groupCountId > 0) {
$rateCount = Discount::getDiscountRateCount($groupCountId, $count);
$listCount = self::getDiscountCountString($groupCountId);
if ($rateCount > 0) {
// Show discount rate if applicable
self::$objTemplate->setVariable('SHOP_DISCOUNT_RATE_COUNT', $rateCount);
}
if (!empty($listCount)) {
// Show discount rate string if applicable
self::$objTemplate->setVariable('SHOP_DISCOUNT_RATE_COUNT_LIST', $listCount);
}
}
}