magento导航获取父类别并具有常量父类别
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了magento导航获取父类别并具有常量父类别相关的知识,希望对你有一定的参考价值。
usefull navigation stuff works in magento 1.5.0.1http://www.webdesign-blog.ch/?p=17
http://www.pauldonnellydesigns.com/blog/get-parent-category-name-in-magento/
<?php $ella_current_category = Mage::registry('current_category'); $ella_parent_id = $ella_current_category->getParentCategory(); echo $ella_parent_id; ?> Name: <?php $parentname = $this->getCurrentCategory()->getParentCategory()->getName(); echo $parentname; ?> <br />Url: <?php $parenturl = $this->getCurrentCategory()->getParentCategory()->getUrl(); echo $parenturl; ?> <br />Level: <?php $parentlevel = $this->getCurrentCategory()->getParentCategory()->getLevel(); echo $parentlevel; ?> <?php # Set parent Category Id $parentCategoryId = 4; $layer = Mage::getModel('catalog/layer'); $activeCategory = $layer->getCurrentCategory(); $pathIds = $activeCategory->getPathIds(); $layer->setCurrentCategory($parentCategoryId); $currentCategory = $layer->getCurrentCategory(); $childCategories = $currentCategory->getChildrenCategories(); $i = ''; $items = ''; $list1 = ''; $list2 = ''; foreach ($childCategories as $_category) { $items = ' <li class="active">'; } else { $items = ' </li><li>'; } $items .= '<a href="'.$_category->getUrl().'">'.$_category->getName();'</a>'; $items .= '</li> '; $i %2 == 0 ? $list1 .= $items: $list2 .= $items; $i++; } echo ' <ul class="list1">'.$list1. '</ul> '; echo ' <ul class="list2">'.$list2. '</ul> '; ?>
以上是关于magento导航获取父类别并具有常量父类别的主要内容,如果未能解决你的问题,请参考以下文章