本文整理汇总了PHP中Varien_Data_Tree_Node::getPositionClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Tree_Node::getPositionClass方法的具体用法?PHP Varien_Data_Tree_Node::getPositionClass怎么用?PHP Varien_Data_Tree_Node::getPositionClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Tree_Node
的用法示例。
在下文中一共展示了Varien_Data_Tree_Node::getPositionClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getHtml
/**
* @param Varien_Data_Tree_Node $menuTree
* @param string $childrenWrapClass
*
* @return string
*/
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
{
$html = '';
$counter = 1;
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass) {
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
}
$blockName = $childLevel == 0 ? 'bennoislost.easy-navigation.renderer.with-children' : 'bennoislost.easy-navigation.renderer.single';
$html .= $this->_renderBlockItem($blockName, $childrenWrapClass, $child, $outermostClassCode);
$counter++;
}
return $html;
}
示例2: _getHtml
/**
* {@inheritDoc}
*/
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
{
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass) {
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
}
if ($child->hasChildren()) {
$outermostClassCode .= ' data-toggle="dropdown" ';
}
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>';
$html .= $this->escapeHtml($child->getName());
if ($child->hasChildren()) {
$html .= ' <b class="caret"></b>';
}
$html .= '</span></a>';
if ($child->hasChildren()) {
if (!empty($childrenWrapClass)) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
$html .= '<ul class="level' . $childLevel . ' dropdown-menu">';
if (Mage::getStoreConfig('catalog/navigation/top_in_dropdown') && $childLevel == 0) {
$prefix = Mage::getStoreConfig('catalog/navigation/top_in_dropdown_prefix');
$suffix = Mage::getStoreConfig('catalog/navigation/top_in_dropdown_suffix');
$html .= '<li class="level1 level-top-in-dropdown">';
$html .= '<a href="' . $child->getUrl() . '"><span>';
$html .= $this->escapeHtml($this->__($prefix) . ' ' . $child->getName() . ' ' . $suffix);
$html .= '</span></a>';
$html .= '</li>';
$html .= '<li class="divider"></li>';
}
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass)) {
$html .= '</div>';
}
}
$html .= '</li>';
$counter++;
}
return $html;
}
示例3: _getHtml
/**
* Recursively generates top menu html from data that is specified in $menuTree
*
* @param Varien_Data_Tree_Node $menuTree
* @param string $childrenWrapClass
* @return string
*/
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
{
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
$brandCategoryId = Mage::getStoreConfig('brand/brand/category_id');
$_helperBrands = Mage::helper('brand');
$brandUrl = Mage::getUrl($_helperBrands->getBrandsUrl());
foreach ($children as $child) {
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass) {
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
}
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$categoryId = str_replace("category-node-", "", $child->getId());
//$url=($categoryId==$brandCategoryId)?$brandUrl:$child->getUrl();
$url = $child->getUrl();
$html .= '<a href="' . $url . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren()) {
if (!empty($childrenWrapClass)) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
$html .= '<ul class="level' . $childLevel . '">';
/*if($childLevel==0)
{
$html .= '<div class="submenu">';
}*/
$html .= $this->_getHtml($child, $childrenWrapClass);
/*if($childLevel==0)
{
$html .= '</div>';
}*/
$html .= '</ul>';
if (!empty($childrenWrapClass)) {
$html .= '</div>';
}
}
$html .= '</li>';
$counter++;
}
return $html;
}
示例4: _getHtml
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
{
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass) {
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
}
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . ' class="nav-link">' . $this->escapeHtml($child->getName()) . '</a>';
if ($child->hasChildren()) {
if (!empty($childrenWrapClass)) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass)) {
$html .= '</div>';
}
$html .= '<span class="subnav-toggle"><i class="icon icon-angle-down"></i><i class="icon icon-angle-up"></i></span>';
}
$html .= '</li>';
$counter++;
}
return $html;
}
示例5: _getMenuItemClasses
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'li_on';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'parent';
}
return $classes;
}
示例6: _getMenuItemClasses
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if (Mage::helper('core/url')->getCurrentUrl() == str_replace(Mage::helper('catalog/product')->getProductUrlSuffix(), "", $item->getUrl())) {
$classes[] = 'custom-active';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'parent';
}
return $classes;
}
示例7: _getHtml
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass = null)
{
$css = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
if ($child->getId() == 'home-link') {
++$counter;
continue;
}
if ($child->getHeaderBgColor()) {
$css .= "li.{$child->getPositionClass()} {\n";
$css .= " background-color: {$child->getHeaderBgColor()} !important;\n";
$css .= "}\n";
}
if ($child->getHeaderBgHoverColor()) {
$css .= "li.{$child->getPositionClass()}:hover {\n";
$css .= " background-color: {$child->getHeaderBgHoverColor()} !important;\n";
$css .= "}\n";
}
$css .= "#wpmm-nav li.{$child->getPositionClass()} > a {\n";
if ($child->getTitleColor()) {
$css .= " color: {$child->getTitleColor()} !important;\n";
}
$css .= "}\n";
if ($child->getTitleHoverColor()) {
$css .= "#wpmm-nav li.{$child->getPositionClass()} > a:hover {\n";
$css .= " color: {$child->getTitleHoverColor()} !important;\n";
$css .= "}\n";
}
if ($child->getLevel() == 0) {
$css .= "li.{$child->getPositionClass()} > .wpmm-nav-content {\n";
if ($child->getContentBgColor()) {
$css .= " background-color: {$child->getContentBgColor()} !important;\n";
}
if ($child->getContentBgImage()) {
$css .= " background-image: url({$child->getContentBgImage()}) !important;\n";
}
switch ($child->getContentBgImgDm()) {
case WeltPixel_MegaMenu_Model_Category_Attribute_Source_Display::REPEAT:
$css .= " background-repeat: repeat;\n";
break;
case WeltPixel_MegaMenu_Model_Category_Attribute_Source_Display::STRETCH:
$css .= " background-size: cover;\n";
break;
}
$css .= "}\n";
}
if ($child->hasChildren()) {
$css .= $this->_getHtml($child);
}
++$counter;
}
if ($childLevel == 0) {
if ($this->getDisplayMode() == WeltPixel_Selector_Model_Adminhtml_System_Config_Displaymode::BOXED) {
$css .= "#wpmm-nav {\n";
$css .= " position: relative;\n";
$css .= "}\n";
}
}
return $css;
}
示例8: _getHtml
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
{
$html = '';
if (Mage::getStoreConfig('meigee_categoriesenhanced/options/status')) {
$childrenWrapClass = 'menu-wrapper';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$catId = explode("category-node-", $child->getId());
$categoryComplete = Mage::getModel('catalog/category')->load($catId[1]);
if ($categoryComplete->getMeigeeCatCustomlink()) {
if ($categoryComplete->getMeigeeCatCustomlink() == '/') {
$itemUrl = Mage::getBaseUrl();
} elseif ($categoryComplete->getMeigeeCatCustomlink() == '#') {
$itemUrl = '#';
} else {
$itemUrl = $categoryComplete->getMeigeeCatCustomlink();
}
} else {
$itemUrl = $child->getUrl();
}
// Get ratio value
$ratio = explode("/", $categoryComplete->getMeigeeCatRatio());
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass) {
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
}
if ($childLevel == 1) {
$html .= '<li class="level1 grid_2 alpha">';
} else {
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
}
$subTitle = '';
if ($childLevel == 1) {
$subTitle = ' class="subtitle"';
}
if ($categoryComplete->getMeigeeCatBlockTop() && $childLevel > 0) {
$html .= '<div class="top-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockTop()) . '</div><div class="clear"></div>';
}
if (!$categoryComplete->getMeigeeCatSubcontent()) {
$html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . '><span' . $subTitle . '>' . $this->escapeHtml($child->getName()) . '</span></a>';
} elseif ($categoryComplete->getMeigeeCatSubcontent() && $childLevel == 0) {
$html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . '><span' . $subTitle . '>' . $this->escapeHtml($child->getName()) . '</span></a>';
}
if ($child->hasChildren()) {
if (!empty($childrenWrapClass) && $childLevel == 0) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
if ($categoryComplete->getMeigeeCatSubcontent()) {
$html .= '<div class="sub-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatSubcontent()) . '</div>';
} else {
if ($categoryComplete->getMeigeeCatBlockTop() && $childLevel == 0) {
$html .= '<div class="top-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockTop()) . '</div><div class="clear"></div>';
}
if ($categoryComplete->getMeigeeCatBlockRight()) {
$html .= '<div class="grid_' . $ratio[0] . ' alpha omega">';
}
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass) && $childLevel == 0) {
if ($categoryComplete->getMeigeeCatBlockRight()) {
$html .= '</div>';
$html .= '<div class="grid_' . $ratio[1] . ' alpha omega right-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockRight()) . '</div>';
}
$html .= '<div class="clear"></div>';
}
if ($categoryComplete->getMeigeeCatBlockBottom()) {
$html .= '<div class="bottom-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockBottom()) . '</div><div class="clear"></div>';
}
}
if (!empty($childrenWrapClass) && $childLevel == 0) {
$html .= '</div>';
}
}
$html .= '</li>';
$counter++;
}
} else {
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$catId = explode("category-node-", $child->getId());
$categoryComplete = Mage::getModel('catalog/category')->load($catId[1]);
//.........这里部分代码省略.........
示例9: _getMenuItemClasses
/**
* Returns array of menu item's classes
*
* @param Varien_Data_Tree_Node $item
* @return array
*/
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
if (Mage::getStoreConfig('mpanel/general/enabled')) {
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
if ($item->getLevel() == 0) {
$classes[] = 'dropdown';
} else {
$classes[] = 'dropdown-submenu';
}
}
return $classes;
} else {
$classes = array();
if ($item->getIsFirst()) {
$classes[] = '';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if ($item->getIsLast()) {
$classes[] = '';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'dropdown';
}
return $classes;
}
}
示例10: _getHtml
/**
* Recursively generates top menu html from data that is specified in $menuTree
*
* @param Varien_Data_Tree_Node $menuTree
* @param string $childrenWrapClass
* @return string
*/
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
{
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child) {
$childClass = '';
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
$megamenuData = array('type' => '', 'layout' => 'menu', 'menu' => 1, 'top' => '', 'bottom' => '', 'right' => '', 'percent' => 0);
if ($childLevel == 0) {
if ($outermostClass) {
$childClass .= ' ' . $outermostClass;
}
$category = Mage::getModel('catalog/category')->load(str_replace('category-node-', '', $child->getId()));
$childClass .= ' ' . $category->getOlegnaxmegamenuType();
$megamenuData['type'] = $category->getOlegnaxmegamenuType();
$megamenuData['layout'] = $category->getOlegnaxmegamenuLayout();
$megamenuData['menu'] = $category->getOlegnaxmegamenuMenu();
$megamenuData['top'] = $category->getOlegnaxmegamenuTop();
$megamenuData['bottom'] = $category->getOlegnaxmegamenuBottom();
$megamenuData['right'] = $category->getOlegnaxmegamenuRight();
$megamenuData['percent'] = $category->getOlegnaxmegamenuRightPercent();
if ($megamenuData['menu'] == '') {
$megamenuData['menu'] = 1;
}
if ($megamenuData['percent'] == '') {
$megamenuData['percent'] = 0;
}
if (empty($megamenuData['layout'])) {
$megamenuData['layout'] = 'menu';
}
}
$showChildren = false;
$leftClass = $rightClass = $top = $bottom = $right = $menu = '';
if ($child->hasChildren() || $childLevel == 0 && $megamenuData['type'] == 'wide' && (!empty($megamenuData['top']) || !empty($megamenuData['bottom']) || !empty($megamenuData['right']) && $megamenuData['percent'] != 0)) {
$showChildren = true;
if ($megamenuData['type'] == 'wide') {
$leftClass = 'megamenu-block-col-' . (6 - $megamenuData['percent']);
$rightClass = 'megamenu-block-col-' . $megamenuData['percent'];
$top = $this->_drawMenuBlock('top', $megamenuData['top']);
$bottom = $this->_drawMenuBlock('bottom', $megamenuData['bottom']);
$right = $this->_drawMenuBlock('right', $megamenuData['right']);
}
if ($megamenuData['menu'] == 1 || $megamenuData['type'] != 'wide') {
$menu .= '<ul class="level' . $childLevel . '">';
$menu .= $this->_getHtml($child, $childrenWrapClass);
$menu .= '</ul>';
$menu .= '<div class="clear"></div>';
}
if (!$child->hasChildren() || $megamenuData['menu'] != 1) {
$childClass .= ' parent parent-fake';
}
}
$child->setClass($childClass);
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>';
if ($showChildren) {
if (!empty($childrenWrapClass)) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
if ($childLevel == 0 && $megamenuData['type'] == 'wide') {
switch ($megamenuData['layout']) {
case 'top_menu':
$html .= '<div class="megamenu-block-col ' . $leftClass . '">';
$html .= $top;
$html .= $menu;
$html .= '</div>';
$html .= '<div class="megamenu-block-col ' . $rightClass . '">';
$html .= $right;
$html .= '</div>';
$html .= '<div class="clear"></div>';
$html .= $bottom;
break;
case 'top_menu_bottom':
$html .= '<div class="megamenu-block-col ' . $leftClass . '">';
$html .= $top;
$html .= $menu;
$html .= $bottom;
$html .= '</div>';
$html .= '<div class="megamenu-block-col ' . $rightClass . '">';
$html .= $right;
$html .= '</div>';
$html .= '<div class="clear"></div>';
//.........这里部分代码省略.........
示例11: _getMenuItemClasses
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
Mage::log('hi', null, 'nil.log');
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'dropdown';
}
return $classes;
}