I'm attempting to remove the My Account link in top.links, then reintroduce them if the customer is logged in or out with custom labels without luck. Anyone got any ideas
<reference name="root">
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/><position>10</position></action>
</reference>
<reference name="top.links">
<customer_logged_out>
<action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getRegisterUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action>
<remove name="checkout_cart_link" />
</customer_logged_out>
<customer_logged_in>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</customer_logged_in>
</reference>
</reference>
Edit:
I'm using Magento 1.7. To clarify, removing the My Account link works using
<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/><position>10</position></action>
However I cannot add a new link using method="addLink"
.
Solution:
I copied the customer.xml from /app/design/frontend/base/layout/ into my templates layout directory and added:
<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>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
</customer_logged_in>
and
<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getRegisterUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action>
</reference>
</customer_logged_out>
Ideally I'd prefer using local.xml to make these changes, but this works too.
<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/><position>10</position></action>
However, if I want to add a new link usingmethod="addLink"
, the new link does not get added.