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!
来源:http://www.webnuggs.com/magento/magento-help/adding-a-logout-link-to-magento
Magento登录与登出链接
本文提供了一段用于在Magento中实现登录与登出功能的PHP代码。该代码可根据用户的登录状态显示相应的登录或登出链接。
3049

被折叠的 条评论
为什么被折叠?



