Expertwebadvisor

  • Magento 2
  • PHP
  • WordPress
  • MySQL
  • SEO
  • Java Script
  • Others
  • Top 10’s

Display Custom Myaccount, Login and Logout link on header in Magento

By Expertwebadvisor | Last Updated: November 21, 2012 | In: Magento


In the custom theming some times we need to display the custom Myaccount, Login and logout link on the header, the solution is given below:
Display Custom Myaccount, Login and Logout link on header in Magento
<?php
 $loggedIn = $this->helper("customer")->isLoggedIn();
 if($loggedIn == 1){ echo "<a href=\"".Mage::getBaseUrl()."customer/account/\" />My Account</a>"; }
 //If the user is logged in, then show a button to logout.
 else{ echo "<a href=\"".Mage::getBaseUrl()."customer/account/create/\" />Register</a>"; }
 //If the user is not logged in, then show a button to login
 ?>

<?php
 $loggedIn = $this->helper("customer")->isLoggedIn();
 if($loggedIn == 1){ echo "<a href=\"".Mage::getBaseUrl()."customer/account/logout/\" />LOGOUT</a>"; }
 //If the user is logged in, then show a button to logout.
 else{ echo "<a href=\"".Mage::getBaseUrl()."customer/account/\" />LOGIN</a>"; }
 //If the user is not logged in, then show a button to login
 ?>

Hope it helps and thanks for reading.

Tags:Custom My account,Login,Login and Logout link in header in Magento,Logout,Magento,Magento Login,Magento Logout,Magento Myaccount


Related Posts

  • Get all the customer details by email id In Magento Get all the customer details by email id In Magento
  • The PDO extension is required for this adapter but the extension is not loaded in Magento Error The PDO extension is required for this adapter but the extension is not loaded in Magento Error
  • Admin Form Fields in Magento Admin Form Fields in Magento
  • Magento 1.3.x, 1.4.x, 1.5.x, 1.6.x, 1.7.x, 1.8.x and 1.9.x upgrade process by using the SSH. Magento 1.3.x, 1.4.x, 1.5.x, 1.6.x, 1.7.x, 1.8.x and 1.9.x upgrade process by using the SSH.
  • Be Social, Share Us Here !!

  • Looking For Something !!

  • Popular Categories !!

    • Magento 2 Guide and Tutorials
    • Home Loan EMI Calculator
    • Car Loan EMI Calculator
    • Personal Loan EMI Calculator
    • Magento Guide & Tutorials
    • PHP Tutorials
    • WordPress Tutorials
    • SEO Tutorials
    • MySQL Guide
    • Opencart Tutorials
    • Linux/Ubuntu Guide
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Facebook
  • Twitter
  • DMCA.com Protection Status

Recent Posts

  • PHP array_​diff_​key Function
  • PHP array_​diff_​assoc Function
  • PHP array_​diff Function
  • PHP array_​count_​values Function
  • PHP array_​combine Function

Welcome to my Blog

Thanks for visiting my Blog, I have started this blog before 8 years ago and sharing my own experience, problem and solutions while working on the different type of projects. Enjoy the reading and don't forget to Facebook likes, Tweets or G+. You can also write me expertwebadvisor@gmail.com
© 2013 - 2025 Powered By
Top