Question

Dans CMS-> page-> DESIGN-> DesignXML

J'ajouter ceci:

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

Cela donne une erreur (en raison de la name="top.menu"), mais ce serait le XML correct pour le menu principal ( pas les top.links)

Était-ce utile?

La solution

Essayez d'utiliser top.links au lieu de top.menu dans votre noeud de référence.

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

Il est impossible d'ajouter simplement des liens vers la navigation catégorie (top.menu> catalog.topnav).
Vous pouvez ajouter des blocs enfants à top.menu, car il est un bloc core/text_list, mais ils seront rendus avant ou après la <div class="nav-container"> du bloc catalog.topnav.

Autres conseils

Vous pouvez créer un bloc à l'intérieur top.menu avec vos liens personnalisés. Ajouter ce fichier dans le local.xml de votre thème:

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

Je pense que c'est la meilleure façon.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top