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


PHP Varien_Data_Tree_Node::getProductCount方法代码示例

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


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

示例1: _getNodeJson

 /**
  * Get JSON of a tree node or an associative array
  *
  * @param Varien_Data_Tree_Node|array $node
  * @param int $level
  * @return string
  */
 protected function _getNodeJson($node, $level = 1)
 {
     $item = array();
     $item['text'] = $this->htmlEscape($node->getName());
     if ($this->_withProductCount) {
         $item['text'] .= ' (' . $node->getProductCount() . ')';
     }
     $item['id'] = $node->getId();
     $item['path'] = $node->getData('path');
     $item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
     $item['allowDrop'] = false;
     $item['allowDrag'] = false;
     if ($node->hasChildren()) {
         $item['children'] = array();
         foreach ($node->getChildren() as $child) {
             $item['children'][] = $this->_getNodeJson($child, $level + 1);
         }
     }
     if (empty($item['children']) && (int) $node->getChildrenCount() > 0) {
         $item['children'] = array();
     }
     if (!empty($item['children'])) {
         $item['expanded'] = true;
     }
     if (in_array($node->getId(), $this->getCategoryIds())) {
         $item['checked'] = true;
     }
     return $item;
 }
开发者ID:CopeX,项目名称:BannerSlider-Magento,代码行数:36,代码来源:Categories.php

示例2: _getNodesArray

 /**
  * Convert categories tree to array recursively
  *
  * @param  Varien_Data_Tree_Node $node
  * @return array
  */
 protected function _getNodesArray($node)
 {
     $result = array('id' => (int) $node->getId(), 'parent_id' => (int) $node->getParentId(), 'children_count' => (int) $node->getChildrenCount(), 'is_active' => (bool) $node->getIsActive(), 'name' => $node->getName(), 'level' => (int) $node->getLevel(), 'product_count' => (int) $node->getProductCount());
     if (is_array($this->_allowedCategoryIds) && !in_array($result['id'], $this->_allowedCategoryIds)) {
         $result['disabled'] = true;
     }
     if ($node->hasChildren()) {
         $result['children'] = array();
         foreach ($node->getChildren() as $childNode) {
             $result['children'][] = $this->_getNodesArray($childNode);
         }
     }
     $result['cls'] = ($result['is_active'] ? '' : 'no-') . 'active-category';
     $result['expanded'] = !empty($result['children']);
     return $result;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:22,代码来源:Tree.php

示例3: _getProductCount

 /**
  * Return the number of products assigned to the category
  *
  * @param Mage_Catalog_Model_Category|Varien_Data_Tree_Node $category
  * @return int
  */
 protected function _getProductCount($category)
 {
     if (null === ($count = $category->getData('product_count'))) {
         $count = 0;
         if ($category instanceof Mage_Catalog_Model_Category) {
             $count = $category->getProductCount();
         } elseif ($category instanceof Varien_Data_Tree_Node) {
             $count = $this->_getProductCountFromTreeNode($category);
         }
     }
     return $count;
 }
开发者ID:gruenspar,项目名称:VertNav,代码行数:18,代码来源:Navigation.php

示例4: _nodeToArray

 protected function _nodeToArray(Varien_Data_Tree_Node $node)
 {
     $result = array();
     $result['category_id'] = $node->getId();
     $result['parent_id'] = $node->getParentId();
     $result['name'] = $node->getName();
     $result['is_active'] = $node->getIsActive();
     $result['position'] = $node->getPosition();
     $result['level'] = $node->getLevel();
     $result['product_count'] = $node->getProductCount();
     $result['children'] = array();
     foreach ($node->getChildren() as $child) {
         $result['children'][] = $this->_nodeToArray($child);
     }
     return $result;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:16,代码来源:Api.php


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