本文整理汇总了PHP中Varien_Data_Tree_Node::getPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Tree_Node::getPosition方法的具体用法?PHP Varien_Data_Tree_Node::getPosition怎么用?PHP Varien_Data_Tree_Node::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Tree_Node
的用法示例。
在下文中一共展示了Varien_Data_Tree_Node::getPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nodeToArray
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['children'] = array();
foreach ($node->getChildren() as $child) {
$result['children'][] = $this->nodeToArray($child);
}
return $result;
}
示例2: nodeToArray
private function nodeToArray(Varien_Data_Tree_Node $node)
{
$result = array();
$category = Mage::getModel('catalog/category')->load($node->getId());
if ($category->getAvailableForSupplier() == 1) {
$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['children'] = array();
foreach ($node->getChildren() as $child) {
$result['children'][] = $this->nodeToArray($child);
}
return $result;
}
示例3: _nodeToArrayPath
/**
* Convert node to array with path information.
* Path information skips the 'Root Catalog' (level=0) and 'Default Category' (level=1) levels.
*
* @param Varien_Data_Tree_Node $node
* @return array
*/
protected function _nodeToArrayPath(Varien_Data_Tree_Node $node, $parentPath)
{
// Only basic category data
$categories = array();
$category = array();
$category['category_id'] = $node->getId();
$category['parent_id'] = $node->getParentId();
$category['name'] = $node->getName();
$category['path'] = !empty($parentPath) && $node->getLevel() > 2 ? $parentPath . '/' . $node->getName() : $node->getName();
$category['is_active'] = $node->getIsActive();
$category['position'] = $node->getPosition();
$category['level'] = $node->getLevel();
$categories[] = $category;
foreach ($node->getChildren() as $child) {
$children = $this->_nodeToArrayPath($child, $category['path']);
$categories = array_merge($categories, $children);
}
return $categories;
}
示例4: _nodeToArray
protected function _nodeToArray(Varien_Data_Tree_Node $node)
{
if (empty($node)) {
return array();
}
$result = $node->debug();
$result['category_id'] = $node->getId();
$result['parent_id'] = $node->getParentId();
$result['name'] = $node->getName();
$result['is_active'] = $node->getIsActive();
$result['is_anchor'] = $node->getIsAnchor();
$result['url_key'] = $node->getUrlKey();
$result['url'] = $node->getRequestPath();
$result['position'] = $node->getPosition();
$result['level'] = $node->getLevel();
$result['products'] = $node->getProducts();
$result['children'] = array();
foreach ($node->getChildren() as $child) {
$result['children'][] = $this->_nodeToArray($child);
}
return $result;
}