Domanda

In CMS-> page-> Design-> DesignXML

aggiungo questo:

<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>

Questo dà un errore (a causa della name="top.menu"), ma quale sarebbe l'XML corretto per il menu principale ( non i top.links)

È stato utile?

Soluzione

Prova a usare top.links invece di top.menu nel nodo di riferimento.

<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>

Non è possibile aggiungere semplicemente i link alla categoria di navigazione (top.menu> catalog.topnav).
È possibile aggiungere blocchi bambino per top.menu, dal momento che è un blocco core/text_list, ma sarà reso prima o dopo la <div class="nav-container"> del blocco catalog.topnav.

Altri suggerimenti

È possibile creare un blocco all'interno top.menu con il tuo link personalizzati. Aggiungere questo nel file di local.xml del vostro tema:

    <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>

Credo che questo sia il modo più semplice.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top