当前位置: 首页>>代码示例>>PHP>>正文


PHP Discount::getDiscountCountArray方法代码示例

本文整理汇总了PHP中Discount::getDiscountCountArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Discount::getDiscountCountArray方法的具体用法?PHP Discount::getDiscountCountArray怎么用?PHP Discount::getDiscountCountArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Discount的用法示例。


在下文中一共展示了Discount::getDiscountCountArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDiscountCountString

 /**
  * Returns a string representation of the count type discounts
  * applicable for the given discount group ID, if any.
  * @param   integer   $groupCountId       The discount group ID
  * @return  string                        The string representation
  * @global  array     $_ARRAYLANG         Language array
  * @author    Reto Kohli <reto.kohli@comvation.com>
  * @static
  */
 static function getDiscountCountString($groupCountId)
 {
     global $_ARRAYLANG;
     $arrDiscount = Discount::getDiscountCountArray();
     $arrRate = Discount::getDiscountCountRateArray($groupCountId);
     $strDiscounts = '';
     if (!empty($arrRate)) {
         $unit = '';
         if (isset($arrDiscount[$groupCountId])) {
             $unit = $arrDiscount[$groupCountId]['unit'];
         }
         foreach ($arrRate as $count => $rate) {
             $strDiscounts .= ($strDiscounts != '' ? ', ' : '') . $_ARRAYLANG['TXT_SHOP_DISCOUNT_FROM'] . ' ' . $count . ' ' . $unit . $_ARRAYLANG['TXT_SHOP_DISCOUNT_TO'] . ' ' . $rate . '%';
         }
         $strDiscounts = $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUNT'] . ' ' . $strDiscounts;
     }
     return $strDiscounts;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:27,代码来源:Shop.class.php

示例2: view_discount_groups_count

 /**
  * Show the count discount editing page
  * @return    boolean             True on success, false otherwise
  * @author    Reto Kohli <reto.kohli@comvation.com>
  */
 function view_discount_groups_count()
 {
     global $_ARRAYLANG;
     if (isset($_POST['discountStore'])) {
         $this->store_discount_count();
     }
     if (isset($_GET['deleteDiscount'])) {
         $this->delete_discount_count();
     }
     // Force discounts to be reinitialised
     Discount::flush();
     self::$objTemplate->addBlockfile('SHOP_PRODUCTS_FILE', 'shop_products_block', 'module_shop_discount_groups_count.html');
     // Discounts overview
     $arrDiscounts = Discount::getDiscountCountArray();
     $i = 0;
     foreach ($arrDiscounts as $id => $arrDiscount) {
         $name = $arrDiscount['name'];
         $unit = $arrDiscount['unit'];
         self::$objTemplate->setVariable(array('SHOP_DISCOUNT_ID' => $id, 'SHOP_DISCOUNT_GROUP_NAME' => contrexx_raw2xhtml($name), 'SHOP_DISCOUNT_GROUP_UNIT' => contrexx_raw2xhtml($unit), 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1)));
         self::$objTemplate->parse('discount');
     }
     // Add/edit Discount
     $id = 0;
     $arrDiscountRates = array();
     if (!empty($_GET['editDiscount'])) {
         $id = intval($_GET['id']);
         $arrDiscountRates = Discount::getDiscountCountRateArray($id);
         self::$objTemplate->setGlobalVariable(array('SHOP_DISCOUNT_EDIT_CLASS' => 'active', 'SHOP_DISCOUNT_EDIT_DISPLAY' => 'block', 'SHOP_DISCOUNT_LIST_CLASS' => '', 'SHOP_DISCOUNT_LIST_DISPLAY' => 'none', 'TXT_ADD_OR_EDIT' => $_ARRAYLANG['TXT_EDIT']));
     } else {
         self::$objTemplate->setGlobalVariable(array('SHOP_DISCOUNT_EDIT_CLASS' => '', 'SHOP_DISCOUNT_EDIT_DISPLAY' => 'none', 'SHOP_DISCOUNT_LIST_CLASS' => 'active', 'SHOP_DISCOUNT_LIST_DISPLAY' => 'block', 'TXT_ADD_OR_EDIT' => $_ARRAYLANG['TXT_ADD']));
     }
     self::$objTemplate->setCurrentBlock('discountName');
     self::$objTemplate->setVariable(array('SHOP_DISCOUNT_ID_EDIT' => $id, 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1)));
     if (isset($arrDiscounts[$id])) {
         $arrDiscount = $arrDiscounts[$id];
         $name = $arrDiscount['name'];
         $unit = $arrDiscount['unit'];
         self::$objTemplate->setVariable(array('SHOP_DISCOUNT_GROUP_NAME' => $name, 'SHOP_DISCOUNT_GROUP_UNIT' => $unit));
     }
     self::$objTemplate->parse('discountName');
     self::$objTemplate->setCurrentBlock('discountRate');
     if (isset($arrDiscountRates)) {
         $arrDiscountRates = array_reverse($arrDiscountRates, true);
         foreach ($arrDiscountRates as $count => $rate) {
             self::$objTemplate->setVariable(array('SHOP_DISCOUNT_COUNT' => $count, 'SHOP_DISCOUNT_RATE' => $rate, 'SHOP_DISCOUNT_RATE_INDEX' => $i, 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1)));
             self::$objTemplate->parse('discountRate');
         }
     }
     // Add a few empty rows for adding new counts and rates
     for ($j = 0; $j < 5; ++$j) {
         self::$objTemplate->setVariable(array('SHOP_DISCOUNT_COUNT' => '', 'SHOP_DISCOUNT_RATE' => '', 'SHOP_DISCOUNT_RATE_INDEX' => $i, 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1)));
         self::$objTemplate->parse('discountRate');
     }
     return true;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:60,代码来源:ShopManager.class.php


注:本文中的Discount::getDiscountCountArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。