Revision: 47826
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 16, 2011 23:44 by nico65
Initial Code
<?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) { if (in_array($_category->getId(), $pathIds)) { $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> '; ?>
Initial URL
http://www.webdesign-blog.ch/?p=17, http://www.pauldonnellydesigns.com/blog/get-parent-category-name-in-magento/
Initial Description
usefull navigation stuff works in magento 1.5.0.1 http://www.webdesign-blog.ch/?p=17 http://www.pauldonnellydesigns.com/blog/get-parent-category-name-in-magento/
Initial Title
magento navigation get parent category and have a constant parent category
Initial Tags
navigation, magento
Initial Language
PHP