문제

In CMS->page->Design->DesignXML

I add this:

<reference name="top.menu">
<action method="addLink" translate="label title" module="customer">
<label>Home</label>
<url></url>
<title>Home</title><prepare>true</prepare>
<urlParams/>
<position>5</position>
</action>
</reference>

This gives an error (because of the name="top.menu") but what would be the correct XML for the top menu (not the top.links)

도움이 되었습니까?

해결책

Try using top.links instead of top.menu in your reference node.

<reference name="top.links">
    <action method="addLink" translate="label title" module="customer">
        <label>Home</label>
        <url>/</url>
        <title>Home</title><prepare>true</prepare>
        <urlParams/>
        <position>5</position>
    </action>
</reference>

It's not possible to simply add links to the category navigation (top.menu > catalog.topnav).
You can add child blocks to top.menu, since it is a core/text_list block, but they will be rendered before or after the <div class="nav-container"> of the catalog.topnav block.

다른 팁

You can create a block inside top.menu with your custom links. Add this in your theme's local.xml file:

    <reference name="header">
        <reference name="top.menu">
            <block type="page/template_links" name="top.menu.custom-links">
                <action method="addLink" translate="label title">
                    <label>New Link</label>
                    <url>my-url</url>
                    <title>New Link</title>
                    <prepare>true</prepare>
                    <urlParams helper="core/url/getHomeUrl"/>
                    <position>60</position>
                </action>
            </block>
        </reference>
    </reference>

I think this is the easiest way.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top