将购物车添加到顶部.菜单在Magento



我正在构建一个导航栏,其中包括用户菜单和购物车以及愿望列表,但试图找出如何将其添加到xml模型中,以使用getchildtml函数包含它。

XML文件:page.xml

<block type="page/html_header" name="header" as="header">

<block type="core/text_list" name="top.menu" as="topMenu" translate="label">

现在就我所能看到的,我必须包括以下地方或扩展块或其他不太确定的东西,请帮助我在正确的方向,甚至指给我一个开发人员指南,将涵盖这。

<block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"/>

在你的主题文件夹app/design/frontend/your_package/your_theme/layout/中创建一个文件local.xml添加以下行并保存文件:

<layout version="0.1.0">
    <default>
        <reference name="top.menu">
            <block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"/>
        </reference>
 </default></layout>

不要忘记在应用更改后清除magento缓存(System-> cache management)。

为了了解更多关于Magento块,布局,模板有一个官方的Magento指南检查这里

最新更新