How to check if an user is logged in – Magento

<?php
 if ($this->helper('customer')->isLoggedIn() ){
  echo '<a href="<?php echo $this->getUrl('customer/account/login/');?>">Login</a>';
 }else {
  echo '<a href="<?php echo $this->getUrl('customer/account/logout/');?>">Logout</a>';
 }
?>
Share

Leave a Reply

Your email address will not be published. Required fields are marked *