本文整理汇总了PHP中Discount::getUnit方法的典型用法代码示例。如果您正苦于以下问题:PHP Discount::getUnit方法的具体用法?PHP Discount::getUnit怎么用?PHP Discount::getUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discount
的用法示例。
在下文中一共展示了Discount::getUnit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}