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


PHP ShopFunctions::categoryListTreeLoop方法代码示例

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


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

示例1: display

 function display($tpl = null)
 {
     $this->loadHelper('html');
     $this->loadHelper('permissions');
     if (!class_exists('shopFunctionsF')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     $model = VmModel::getModel();
     $layoutName = $this->getLayout();
     $task = JRequest::getWord('task', $layoutName);
     $this->task = $task;
     $this->perms = Permissions::getInstance();
     // to add in vmview ?
     $multivendor = Vmconfig::get('multix', 'none');
     $this->multiX = $multivendor !== 'none' && $multivendor != '' ? true : false;
     if ($layoutName == 'edit') {
         $this->loadHelper('shopfunctions');
         $category = $model->getCategory('', false);
         if (isset($category->category_name)) {
             $name = $category->category_name;
         } else {
             $name = '';
         }
         $this->SetViewTitle('CATEGORY', $name);
         $model->addImages($category);
         if ($category->virtuemart_category_id) {
             $this->relationInfo = $model->getRelationInfo($category->virtuemart_category_id);
         }
         $this->parent = $model->getParentCategory($category->virtuemart_category_id);
         $this->jTemplateList = ShopFunctions::renderTemplateList(JText::_('COM_VIRTUEMART_CATEGORY_TEMPLATE_DEFAULT'));
         if (!class_exists('VirtueMartModelConfig')) {
             require JPATH_VM_ADMINISTRATOR . '/models' . DS . 'config.php';
         }
         $this->productLayouts = VirtueMartModelConfig::getLayoutList('productdetails', $category->category_product_layout, 'category_product_layout');
         $this->categoryLayouts = VirtueMartModelConfig::getLayoutList('category', $category->category_layout, 'categorylayout');
         // front autoset parent category
         if (!$category->virtuemart_category_id) {
             $this->parent->virtuemart_category_id = jRequest::getInt('category_parent_id', 0);
         }
         //Nice fix by Joe, the 4. param prevents setting an category itself as child
         // Note Studio42, the fix is not suffisant, you can set the category in a children and get infinit loop in router for eg.
         $this->categorylist = ShopFunctions::categoryListTree(array($this->parent->virtuemart_category_id), 0, 0, (array) $category->virtuemart_category_id);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $this->vendorList = ShopFunctions::renderVendorList($category->virtuemart_vendor_id, false);
         }
         $this->category = $category;
         $this->addStandardEditViewCommands($category->virtuemart_category_id, $category);
     } else {
         $category_id = JRequest::getInt('filter_category_id');
         if (JRequest::getWord('format', '') === 'raw') {
             $tpl = 'results';
         } else {
             $this->SetViewTitle('CATEGORY_S');
             $this->addStandardDefaultViewCommands();
             $this->categorylist = ShopFunctions::categoryListTreeLoop((array) $category_id, 0, 0);
             if ($this->multiX && $this->adminVendor == 1) {
                 JToolBarHelper::custom('toggle.shared.1', 'publish', 'yes', JText::_('COM_VIRTUEMART_SHARED'), true);
                 JToolBarHelper::custom('toggle.shared.0', 'unpublish', 'no', JText::_('COM_VIRTUEMART_SHARED'), true);
             }
         }
         $this->catmodel = $model;
         $this->addStandardDefaultViewLists($model, 'category_name');
         $this->categories = $model->getCategoryTree($category_id, 0, false, $this->lists['search']);
         $this->pagination = $model->getPagination();
         //we need a function of the FE shopfunctions helper to cut the category descriptions
         jimport('joomla.filter.output');
     }
     parent::display($tpl);
     if ($tpl === 'results') {
         echo $this->AjaxScripts();
     }
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:72,代码来源:view.html.php

示例2: categoryListTree

 /**
  * Creates structured option fields for all categories
  *
  * @todo: Connect to vendor data
  * @author RolandD, 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 categoryListTree($selectedCategories = array(), $ispublish = 0, $cid = 0, $level = 0, $disabledFields = array())
 {
     //self::$counter++;
     $publish = false;
     if ($ispublish == 1) {
         $publish = true;
     }
     static $categoryTree = '';
     $virtuemart_vendor_id = 1;
     // 		vmSetStartTime('getCategories');
     $categoryModel = VmModel::getModel('category');
     $level++;
     $categoryModel->_noLimit = TRUE;
     $app = JFactory::getApplication();
     $records = $categoryModel->getCategories($publish, $cid);
     // 		vmTime('getCategories','getCategories');
     $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 . '">';
                     $categoryTree .= str_repeat(' - ', $level - 1);
                     $categoryTree .= $category->category_name . '</option>';
                 }
             }
             if ($categoryModel->hasChildren($childId)) {
                 $categoryTree .= ShopFunctions::categoryListTreeLoop($selectedCategories, $childId, $level, $disabledFields);
             }
         }
     }
     return $categoryTree;
 }
开发者ID:ForAEdesWeb,项目名称:AEW9,代码行数:55,代码来源:vmcategories.php


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