【问题标题】:How to add Magento CMS PAGES to topMenu (not in top.links) in Magento 1.7.2如何在 Magento 1.7.2 中将 Magento CMS PAGES 添加到 topMenu(不在 top.links 中)
【发布时间】:2013-08-21 08:12:26
【问题描述】:

我想在 Magento 1.7.2 的自定义模板中将 Magento CMS PAGES 添加到 topMenu(不在 top.links 中)

所以我在路径中创建了一个名为 local.xml 的文件

app/design/frontend/mytheme/default/layout/local.xml

xml中的内容:

<?xml version="1.0"?>
<layout version="0.1.0">
    <default translate="label" module="page">   
      <reference name="topMenu">
            <action method="addLink" translate="label title"><label> TEST </label><url helper="customer/getAccountUrl"/><title> TEST </title><prepare/><urlParams/><position>1</position></action>
        </reference>
    </default>
</layout>

这个 XML 应该在 topMenu 中创建一个名为 TEST 的链接,该链接与“customer/getAccountUrl”连接

但它没有显示我的链接...有人怀疑它可能是错的吗?

【问题讨论】:

  • 完全相同的代码使用“top.links”而不是“topMenu”运行,但这不是我想要的......我需要出现指向topMenu的TEST cms链接......任何建议?

标签: php magento hyperlink


【解决方案1】:

您可以像这样向 CMS 页面添加新链接:

app/design/frontend/default/theme/layout/customer.xml(大约第 49 行)

<default>
    <!-- Mage_Customer -->
    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>60</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Corporate Orders</label><url>http://www.yourdomain.com/corporate-orders.html</url><title>Corporate Orders</title><prepare/><urlParams/><position>50</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Delivery</label><url>http://www.yourdomain.com/delivery.html</url><title>Delivery</title><prepare/><urlParams/><position>40</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Contact Us</label><url>http://www.yourdomain.com/contact-us.html</url><title>Contact Us</title><prepare/><urlParams/><position>20</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Customer Service</label><url>http://www.yourdomain.com/customer-service.html</url><title>Customer Service</title><prepare/><urlParams/><position>30</position></action>   
    </reference>

这是我在 Magento 1.6.1 网站上的示例,但我看不出这在 1.7.2 上有何不同。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-15
    • 2023-03-09
    • 2013-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    相关资源
    最近更新 更多