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

  • Check current page is homepage or not In Magento Check current page is homepage or not In Magento
  • Display Previous Product & Next Product Links on Product view Page In Magento Display Previous Product & Next Product Links on Product view Page In Magento
  • Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider alert message in Magento admin Your web server is configured incorrectly. As a result, configuration files with sensitive information are accessible from the outside. Please contact your hosting provider alert message in Magento admin
  • Show Shopping Cart Items And Totals In Magento Show Shopping Cart Items And Totals In Magento
  • 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