0
点赞
收藏
分享

微信扫一扫

magento 添加退出链接 Adding a Logout Link to Magento

一脸伟人痣 2023-05-05 阅读 64


Magento seems to include the “Login” link by default. However, Magento does not seem to show a link to Logout after one logs in.

 

If you have been searching tirelessly for a solution to your Magento logout woes, have no worries your search is at an end! We’ve already searched and found. We’ve included the code you will need to add a Logout link to Magento. This code actually only displays the pertinent link – so if a user is already logged in they will only see a Logout link and if a user is not Logged in then they will see a Login link.

Here is the code:

<?php if (! Mage::getSingleton('customer/session')->isLoggedIn()): ?>
<a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>"><?php echo $this->__('Login') ?></a>
<?php else: ?>
<a href="<?php echo Mage::helper('customer')->getLogoutUrl(); ?>"><?php echo $this->__('Logout') ?></a>
<?php endif; ?>

 


So there you have it, a way to add a Logout link to Magento!

 

 

举报

相关推荐

0 条评论