我正在研究基于Magento的侧边栏购物车功能的下拉购物车。感谢教程,我在编辑checkout.xml和page.xml文件时得到了这个工作,但是我想通过编辑我的local.xml文件来实现真正的Magento方式。这里是我的代码:Magento:自定义下拉车 - 如何获得“我的购物车”链接?
header.phtml
div class="top-cart">
<?php echo $this->getChildHtml('topCart') ?>
<div class="top-cart-menu">
<?php echo $this->getChildHtml('topCartBlock') ?>
</div>
</div>
local.xml中
<block type="checkout/cart_sidebar" name="cart_sidebar" as="topCartBlock" template="checkout/cart/sidebar.phtml" before="-" >
<action method="addItemRender">
<type>simple</type>
<block>checkout/cart_item_renderer</block>
<template>checkout/cart/sidebar/default.phtml</template>
</action>
<block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
<label>Shopping Cart Sidebar Extra Actions</label>
</block>
</block>
到目前为止它的工作,我得到的侧边栏迷你车在展示我的头。但为了实现鼠标悬停,我需要购物车链接。当我在page.xml中将上面的代码放在下面的代码中时,它正在工作,但是当我将它添加到local.xml中时,链接并未显示。
<reference name="top.cart">
<action method="addLink" translate="label title">
<label>Your Cart</label>
<url>checkout/cart</url>
<title>Your cart</title>
<position>1</position>
<li/>
<a>id="top-link-cart"</a>
</action>
</reference>
如何修改此代码以获取“我的购物车”链接?
您可以创建自己的答案,并接受它如果你找到了一个可行的解决方案。 – 2012-02-11 02:28:35
一旦您接受了答案(通过点击勾号),就没有必要用* [解析] *标记标题。 – menjaraz 2012-02-13 11:43:53