Magento 移动小的购物车

时间: 2011-03-01 / 分类: Magento 专栏, 系统运维 / 浏览次数: 736 views / 0个评论 发表评论

话不多说,有效果才是好的

1)复制购物篮的BLOCK代码:
\\design\frontend\default\default\layout\checkout.xml
<block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.phtml”/>

2) 打开app\design\frontend\default\default\layout\page.xml (以默认模板为例,下同)
找到下面的代码:
<block type=”page/html_header” name=”header” as=”header”> //第58行

在这个BLOCK里面,你会看到一个子BLOCK。
复制你的新BLOCK(步骤一中)到这儿,添加 “as”的属性,并且设置为“topcart” — 最后的代码应该如下:

<block type=”page/html_header” name=”header” as=”header”>
<block type=”page/template_links” name=”top.links” as=”topLinks”/>
<block type=”page/switch” name=”store_language” as=”store_language” template=”page/switch/languages.phtml”/>
<block type=”core/text_list” name=”top.menu” as=”topMenu”/>
<!–new block –>
<block type=”checkout/cart_sidebar” name=”cart_sidebar” as=”topcart” template=”checkout/cart/sidebar.phtml”/>
</block>

3)最后,找到app\design\frontend\default\default\template\page\html\header.phtml并且添加以下代码:
//请把这个代码放到任何你想显示小购物篮的地方.
<?php echo $this->getChildHtml(‘topcart’); ?>

注意事项:
在修改界面的XML部分, 你或许要修改以下的部分:
<reference name=”right”> (这部分是根据你的模板决定)
<action method=”unsetChild”><name>cart_sidebar</name></action>

发表评论

您的昵称 *

您的邮箱 *

您的网站