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

标签 xml magento hyperlink

我想使用 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>

关于xml - 使用 local.xml 更改或重新排列 Magento 登录和注销(顶部链接)位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11271194/

相关文章:

java - 使用 'if (position == x)' 替换主 fragment

c# - 无需装饰器的反序列化

c# - XDocument.Save(string filename)是重新保存整个文件还是只是更改?

magento - 如何编辑管理面板订单 View 按钮?

php - 查找页面中的所有 href 并替换为保持先前链接的链接 - PHP

html - Outlook 在 HTML 电子邮件中的超链接后在方括号中添加目标 URL

c# - 如何从 XML 文档读取值以构建组合框?

php - Codeigniter - SEO 友好的 URL 结构(Slug 实现)

php - 从模块更新前端布局

javascript - 链接显示在“查看源代码”中,但不可点击