トップリンクを並べ替える方法


7

みなさん、こんにちは。

トップリンクを並べ替えたい。たとえば、私のwhishlistまたは私のカートよりも最初にログインすることを望んでいます トップリンクを配置するための位置タグがあることは知っていますが、機能しません。

私のサイトの注文は register mywhishlist mycart logout myaccountです。

ログイン前の順序はでなければなりませんmywhishlist mycart login register myaccount。ログイン後の順序はです mywhishlist mycart register logout myaccount

私を助けてください。ありがとう。


順序を変更しようとしているXMLの部分を投稿できますか?
user487772 2013

私は1.9で同じ問題を経験しました。位置を設定でき1000000ますが、同時に追加されるリンクに対してのみ位置が相対的であるように、リンクはxml順に追加されます。
Walf、2014年

回答:


7

しばらく壁に頭をぶつけた後、XMLが嘘をついていることに気づきました。の子ノード<action method="addLink">が結合しているように見えるだけです。実際には、これらはの引数に対応する順序付きリストですMage_Page_Block_Template_Links::addLink()。それはより読みやすいですので、このようにXMLノード名がありません影響を与えてきた、彼らは単にある<arg0><arg1>など

要約すると、ノードは常に移動する必要があります。

<label>
<url>
<title>
<prepare>
<urlParams>
<position>
<liParams>
<aParams>
<beforeText>
<afterText>

空でないノードは、最後の空でないノードの後に​​のみ省略できます。例:

<label>Foo Bar</label>
<url>foo-bar</url>
<title>Foo Bar</title>
<prepare/>
<urlParams/>
<position>200</position>

ブリリアント!! ありがとう、私は大きな頭痛の種を救いました!
Martijn van Hoof

3

こんにちはchecko以下のファイルをテンプレートレイアウトxmlに

wishlist.xml

<action method="addLinkBlock"><blockName>wishlist_link</blockName><prepare/><urlParams/><position>10</position></action>

checkout.xml

<action method="addCartLink"><prepare/><urlParams/><position>30</position></action>

customer.xml

<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>100</position><liParams/></action>
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>50</position></action>
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>50</position><liParams/></action>

Magentoのデフォルト位置を確認します

マイアカウント= 10パス-> app \ design \ frontend \ default \ default \ layout \ customer.xml

Whislist = 30 Path-> app \ code \ core \ Mage \ Wishlist \ Block \ Links.php

Mycart = 50パス-> app \ code \ core \ Mage \ Checkout \ Block \ Links.php

チェックアウト= 60->パス-> app \ code \ core \ Mage \ Checkout \ Block \ Links.php

ログイン/ログアウト= 100パス-> app \ design \ frontend \ default \ default \ layout \ customer.xml


0

レイアウトxmlファイルで「position」タグを追加または更新することにより、topLinkを並べ替えることができます。

例えば:。以下は、ハンドル "customer_logged_out"内の[Magento root folder] /app/design/frontend/base/default/layout/customer.xmlのMy Account Linkのコードです。

  <reference name="top.links">
        <action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
    </reference>

独自のテーマを作成し、上記のコードのアクションタグ内で位置の値を100から10に更新できます。


0

レイアウトxmlファイルのposition属性を使用して、トップリンクを並べ替えることができます。customer.xmlファイルと同様に、ログインとログアウトの順序は、このファイルから、wishlist.xmlおよびcheckout.xmlと同じように変更できます。

<customer_logged_in>
    <reference name="top.links">
                    <action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
            </reference>
</customer_logged_in>

<customer_logged_out>
     <reference name="top.links">
                    <action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
            </reference>
</customer_logged_out>

これがお役に立てば幸いです。

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.