catalog_category_default 当分类没有开启属性筛选,进入到底层分类的时候,左边就没有导航了
很多情况下,尤其是子分类比较多时,需要在底层分类的左栏显示它的同级分类
今天整理模板的时候,把以前的代码稍微整理了一下,比之前的解决方法要简洁一些,暂记备忘如下:
修改 template/catalog/navigation/left.phtml 文件,参考如下代码
…..
<?php $_count = is_array($_categories)?count($_categories):$_categories->count();
///code added
if(!$_count) {
if($this->getCurrentCategory()->getParentCategory()->getId() != Mage::app()->getStore()->getRootCategoryId())
$_categories = $this->getCurrentCategory()->getParentCategory()->getChildrenCategories();
$_count = is_array($_categories)?count($_categories):$_categories->count();
}
///code end
?>
<?php if($_count): ?>……
catalog_category_layered 显示模式 可以进行属性筛选,比较清晰,暂时就不对这个进行处理了
待以后补充