问题描述
|
如何解决?我想不在顶部菜单中而是在“我的购物车”链接中使用“我的购物车”链接。所以我从checkout.xml中删除了:
<reference name=\"top.links\">
<block type=\"checkout/links\" name=\"checkout_cart_link\">
<action method=\"addCheckoutLink\"></action>
</block>
</reference>
然后添加新参考:
<reference name=\"top.mybasket\">
<block type=\"checkout/links\" name=\"checkout_cart_link\">
<action method=\"addCartLink\"></action>
</block>
</reference>
从page.xml我添加此:
<block type=\"page/html_header\" name=\"header\" as=\"header\">
<block type=\"page/template_links\" name=\"top.links\" as=\"topLinks\"/>
// other blocks
<block type=\"page/template_links\" name=\"top.mybasket\" as=\"my_basket_count\"/>
</block>
接下来,我通过以下方式添加header.phtml:
<?php echo $this->getChildHtml(\'my_basket_count\') ?>
一切正常。
我的问题是,如何在local.xml中完成整个过程?我尝试过,但看起来很关键!
解决方法
如果我正确理解您的要求,这是您需要的local.xml的内容:
<?xml version=\"1.0\"?>
<layout version=\"0.1.0\">
<default>
<reference name=\"top.links\">
<remove name=\"checkout_cart_link\"/>
</reference>
<reference name=\"root\">
<reference name=\"header\">
<block type=\"page/template_links\" name=\"top.mybasket\" as=\"my_basket_count\"/>
</reference>
</reference>
<reference name=\"top.mybasket\">
<block type=\"checkout/links\" name=\"checkout_cart_link\">
<action method=\"addCartLink\"></action>
</block>
</reference>
</default>
</layout>