mrbaselier
mrbaselier

Reputation: 3

Magento - Hide link in main menu for logged in users

I am trying to modify my main navigation menu.

In the menu for guest I have a link (category) called "Log in". But after the custommer is logged in I want to change the name from "Log In" to "Shop".

I searched all over the place. I hope this is posible by modifying my local.xml file vut any solution would do.

Upvotes: 0

Views: 3233

Answers (3)

Shivam
Shivam

Reputation: 2443

in customer.xml

<default>
     <reference name="top.links">
     </reference>
</default>
<customer_logged_in>
    <reference name="top.links">
     <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>
     <action method="addLink" translate="label title" module="customer"><label>Shop</label><url helper="customer/getLogoutUrl"/><title>Shop</title><prepare/><urlParams/><position>100</position></action>
    </reference>
</customer_logged_in>

delete the content from default. as i did above

Upvotes: 0

Netwrk - Henk Provily
Netwrk - Henk Provily

Reputation: 11

Added something to it I always use:

<?php $session=Mage::getSingleton('customer/session', array('name'=>'frontend') ); ?>
<?php if ($session->isLoggedIn()) { ?>
<?php } else { ?>
<?php } ?>

Upvotes: 0

Roy Hayward
Roy Hayward

Reputation: 84

So to detect if you are logged in, you can call this function:

$this->helper(‘customer’)->isLoggedIn()

Where you have your code displaying the the login and place it in an if condition

if($this->helper(‘customer’)->isLoggedIn()){
//your shop code here.
} else {
//keep login code here.
}

Upvotes: 1

Related Questions