How to remove links from top.liknks when loggin in / out in Magento 1.6.2

eb_Dev picture eb_Dev · May 25, 2012 · Viewed 9.4k times · Source

I've had a good search around and found the customer_logged_in and customer_logged_out tags but I can't get them to work properly, this I'm sure is down to my misunderstanding of them.

My goal is to hide the log in, account and checkout links from the block top.links when the user is not logged in and show them when the user is logged in.

I have placed the following at the end of my local.xml file to try and remove the log in link:

    <customer_logged_in>
        <reference name="top.links">
            <action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
        </reference>
    </customer_logged_in>

</default>

But it does not work. Can someone please explain why this does not work? It's driving me crazy!

Answer

pkoltermann picture pkoltermann · Mar 29, 2013

Removing links in local.xml works in my case. Here is the code:

<customer_logged_in>
    <reference name="top.links">
        <action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
    </reference>
</customer_logged_in>
<customer_logged_out>
    <reference name="top.links">
        <action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
    </reference>
</customer_logged_out>