当前位置 : 主页 > 网页制作 > xml >

使用local.xml更改或重新排列Magento登录和注销(顶部链接)位置

来源:互联网 收集:自由互联 发布时间:2021-06-13
我想使用local.xml重新排列我的顶级链接 – 特别是登录/注销链接.这是否可以在不删除链接然后重新添加它们并修改其位置标记的情况下实现? 当前(默认情况下)登录和注销在customer.xm
我想使用local.xml重新排列我的顶级链接 – 特别是登录/注销链接.这是否可以在不删除链接然后重新添加它们并修改其位置标记的情况下实现?

当前(默认情况下)登录和注销在customer.xml中设置为位置100:

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

我希望他们都在位置1(通过local.xml).

我知道setAttribute操作方法,但我不确定如何在这种情况下使用它.

我没有找到一种更有效的方法在local.xml中执行此操作,因此我删除了链接并使用修改后的位置参数重新添加它们:

<customer_logged_in>
    <reference name="top.links">
        <action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
        <action method="addLink" translate="label title" module="customer">
            <label>Log Out</label>
            <url helper="customer/getLogoutUrl"/>
            <title>Log Out</title>
            <prepare/>
            <urlParams/>
            <position>4</position>
            <liParams>id="top-logout"</liParams>
            <aParams/>
        </action>
    </reference>
</customer_logged_in>

<customer_logged_out>
    <reference name="top.links">
        <action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
        <action method="addLink" translate="label title" module="customer">
            <label>Log In</label>
            <url helper="customer/getLoginUrl"/>
            <title>Log In</title>
            <prepare/>
            <urlParams/>
            <position>4</position>
            <liParams>id="top-login"</liParams>
            <aParams/>
        </action>
    </reference>
</customer_logged_out>
网友评论