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


PHP ShopFunctions::counter方法代码示例

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


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

示例1: categoryListTreeLoop

 /**
  * Creates structured option fields for all categories
  *
  * @todo: Connect to vendor data
  * @author Max Milbers, jseros
  * @param array 	$selectedCategories All category IDs that will be pre-selected
  * @param int 		$cid 		Internally used for recursion
  * @param int 		$level 		Internally used for recursion
  * @return string 	$category_tree HTML: Category tree list
  */
 public static function categoryListTreeLoop($selectedCategories = array(), $cid = 0, $level = 0, $disabledFields = array(), $isSite, $vendorId, $vmlang, $categoryParentName = '')
 {
     static $categoryTree = '';
     if ($level == 0) {
         $categoryTree = '';
         self::$counter = 0;
     }
     self::$counter++;
     $categoryModel = VmModel::getModel('category');
     $level++;
     $categoryModel->_noLimit = TRUE;
     $records = $categoryModel->getCategories($isSite, $cid, false, '', $vendorId);
     $selected = "";
     if (!empty($records)) {
         foreach ($records as $key => $category) {
             $childId = $category->category_child_id;
             if ($childId != $cid) {
                 if (in_array($childId, $selectedCategories)) {
                     $selected = 'selected=\\"selected\\"';
                 } else {
                     $selected = '';
                 }
                 $disabled = '';
                 if (in_array($childId, $disabledFields)) {
                     $disabled = 'disabled="disabled"';
                 }
                 if ($disabled != '' && stristr($_SERVER['HTTP_USER_AGENT'], 'msie')) {
                     //IE7 suffers from a bug, which makes disabled option fields selectable
                 } else {
                     $categoryTree .= '<option ' . $selected . ' ' . $disabled . ' value="' . $childId . '">';
                     $categoryName = $category->category_name;
                     if (VmConfig::get('full_catname_tree', 0)) {
                         if (!empty($categoryParentName)) {
                             $categoryName = $categoryParentName . ' | ' . $category->category_name;
                         }
                     } else {
                         $categoryTree .= str_repeat(' - ', $level - 1);
                     }
                     $categoryTree .= $categoryName . '</option>';
                 }
             }
             if ($categoryModel->hasChildren($childId)) {
                 self::categoryListTreeLoop($selectedCategories, $childId, $level, $disabledFields, $isSite, $vendorId, $vmlang, $categoryName);
             }
         }
     }
     return $categoryTree;
 }
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:58,代码来源:shopfunctions.php


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