如何解决?我希望“我的购物车”链接不在顶部菜单中,而是在其他位置。所以我从 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>
关于magento - magento 中 local.xml 的更新似乎很重要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6159525/