左侧栏显示菜单!!

Main aims:

* Add the category tree of current viewing in left navigation sidebar instead of the “Browse by” box on top

* Remove the popup menu

There are 3 files that you need to change, including one hardcode file (navigation.php). Therefore, you better make sure that you already backup these files before changing them. And also, keep changing the hardcode file that way whenever you update your Margento version because it may change this file automatically. (My current ver is 1.4.0.1)

Get into your current theme in your Magento folder, in this case, my theme is “TRANGUYEN” :

1) app/design/frontend/default/TRANGUYEN/layout/catalog.xml : find and remove some codes in lines 82 to 84 like this

<!–<reference name=”left”>
<block type=”catalog/navigation” name=”catalog.leftnav” after=”currency” template=”catalog/navigation/left.phtml”/>
</reference>–>

2) skin/frontend/default/TRANGUYEN/css/styles.css : add these codes in line 1182 to 1188 like this, (max level = 5)

/*new code for leftnav*/
#leftnav li.level1 { padding-left:10px; }
#leftnav li.level2 { padding-left:20px; }
#leftnav li.level3 { padding-left:30px; }
#leftnav li.level4 { padding-left:40px; }
#leftnav li.level5 { padding-left:50px; }
/*end new code*/

3) app/code/core/Mage/Catalog/Block/navigation.php: this is the core code file of Magento, you need to add some codes in lines 223 and 234 as below:

Copy code:

if ($this->isCategoryActive($category)) {     // new code for left navigation category tree
if ($hasChildren){

$j = 0;
$htmlChildren = ”;
foreach ($children as $child) {
if ($child->getIsActive()) {
$htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt);
}
}

if (!empty($htmlChildren)) {
/*$html.= ‘<ul>’.”/n”                  // new code for left navigation category tree
.$htmlChildren                             //
.’</ul>’;*/                                       //
$html .= $htmlChildren;         //
}

}
}

Done. Enjoy !

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值