前一段时间,我在此站点上设置了左侧导航:http://makethemostof.co.uk/,以显示顶级类别中的所有子类别,并显示子类别中的所有兄弟类别。显示父类别儿童的列表
我现在想要添加分层导航到子类别(但不是父类别)。分层导航工作正常,但我的代码显示兄弟类别不再起作用。请看这里:http://makethemostof.co.uk/house-garden/kitchen父母('房子和花园')中可以找到的列表应该出现在过滤器的上方,但它不是。
这是我在布局/的catalog.xml:
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left.phtml"/>
<block type="mana_filters/view_category" name="mana.catalog.leftnav" template="catalog/layer/view.phtml"/>
<!--<block type="catalog/layer_view" name="catalog.filters" template="catalog/layer/view.phtml"/>-->
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference>
</catalog_category_layered>
这里是我的模板/目录/导航/ left.phtml:
<?php $currentCat = Mage::registry('current_category');
if ($currentCat->getParentId() == Mage::app()->getStore()->getRootCategoryId()) {
echo '<h2 class="grad">'.$this->getCurrentCategory()->getName().'</h2>';
$loadCategory = $currentCat;
} else {
echo '<h2 class="grad"><a href="'.$this->getCurrentCategory()->getParentCategory()- >getURL().'">'.$this->getCurrentCategory()->getParentCategory()->getName().'</a></h2>';
$loadCategory = Mage::getModel('catalog/category')->load($currentCat->getParentId());
}
$cats = $loadCategory->getChildrenCategories(); ?>
<ul>
<?php foreach($cats as $category): ?>
<? $category->load();
if ($category->getIsActive() && $category->getIncludeInMenu()) { ?>
<li>
<a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?></a>
</li>
<? } ?>
我只能假设在上面的某个地方有错误。任何帮助确定它将非常感激。谢谢!
感谢您尝试R.S! - 不幸的是,这只意味着至少工作的父类别原来不起作用。请有更多想法吗? –
我刚刚更新了我的代码和工作副本 –
感谢R.S--这会更好,但恐怕导航仍然隐藏在锚点类别中。 –