加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 22:55:40 所属栏目:百科 来源:网络整理
导读:我想使用local.xml重新排列我的顶级链接 – 特别是登录/注销链接.这是否可以在不删除链接然后重新添加它们并修改其位置标记的情况下实现? 当前(默认情况下)登录和注销在customer.xml中设置为位置100: customer_logged_in reference name="top.links" actio
我想使用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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读