Change or rearrange Magento Login and Log Out (top links) position using local.xml

hyperlink, magento, xml

Solution

I have not found a more efficient way to do this within `local.xml`, so I have removed the links and re-added them with modified position parameters:

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

Problem

I'd like to rearrange my top links using `local.xml`--specifically the login/log out links. Is this possible without removing the links then re-adding them and modifying their position tags? Currently (and by default) Log In and Log Out are set to position 100 in `customer.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> ``` I would like them both at position 1 (via `local.xml`). I am aware of the `setAttribute` action method but I am unsure how to use it in this case.

Original source