I deleted the default RWD account icon with dropdown as I didn't want it.

Instead I want two simple links in my header: one which says account that simply takes you to the account page, then one that says login which changes to log out when the customer is logged in.

enter image description here

For a better idea of what I am looking to do see the attached image.

Any ideas how I can do this?

  • Just detect if the user is logged in using Mage::getSingleton('customer/session')->isLoggedIn() and change the text accordingly – Julien Lachal Apr 13 '16 at 13:21
  • Thank you for the answer but how would I go about adding the links in the first place? I am quite new to magento development unfortunately – Oli Tuck Apr 13 '16 at 13:29

I normally go with template approach.

   <div class="account-links">
        if ($this->helper('customer')->isLoggedIn()) {
            <a href="<?php echo Mage::getUrl('customer/account'); ?>">Account</a>
            <a href="<?php echo Mage::getUrl('customer/account/logout'); ?>"><?php echo $this->__('Log out'); ?></a>
        <?php } else {
            <a href="<?php echo Mage::getUrl('customer/account/login'); ?>"><?php echo $this->__('Log in'); ?></a>
            <span> or</span>
            <a href="<?php echo Mage::getUrl('customer/account/create'); ?>"><?php echo $this->__('Register'); ?></a>
        <?php } ?>

Stick the above in a template file your themes header.phtml file

| improve this answer | |
  • Thanks very much! does it matter where I put it in header.phtml? – Oli Tuck Apr 13 '16 at 15:30
  • Ok it worked but appeared underneath my nav for some reason. As seen here: dl.dropboxusercontent.com/u/171478031/… Any idea how to move it above the nav at the top right? thanks – Oli Tuck Apr 13 '16 at 15:35
  • You will need to place it above <?php echo $this->getChildHtml('topMenu') ?> within your header.phtml file – Bobadevv Apr 13 '16 at 15:39

Go to app/design/frontend/default/your-theme/layout

Then find the .xml files according to the toplinks you want to change

customer.xml for "My Account, Login, Logout and My Wishlist"`

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

There you'll have something with which you can work, you'll just need to adapt it to your needs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.