如何将magento购物车显示在网站首页
1.代码:<!--new block -->
<block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"/>
带page.xml 文件中(大约69行);效果:
<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 type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
<label>Page Header</label>
<action method="setElementClass"><value>top-container</value></action>
</block>
</block>
2.header.phtml 在该文件中调用你的购物车信息:
<?php echo $this->getChildHtml('topcart'); ?>
3. 可以省略(更新block。到后台 CMS => Manage Pages ,找到首页cms,进入找到Custom Design 选项,在Layout Update XML 里面填写以下代码:<referencename="header">
<actionmethod="unsetChild"><name>cart_sidebar</name></action>
</reference>)
(责任编辑:好模板) |