It is surprisingly often the case, that was forgotten in a template to incorporate a logout link. If the customer is logged, he can not get out. Thus, one should enter a logout link, which is of course only appears, if the user is logged on.
If it's just a (or more) simple links is, to be exclusively displayed, If you are logged in, this can be done with a very simple code snippet, which is simply written to the appropriate file phtml.
Example header.phtml in the folder app / design / frontend / rwd / default / template / page / html
Here I would like to have a logout link next to the account link – but only if you are logged.
To this end, I add
<?php if (Magus::getSingleton('Customer / session')->isLoggedIn()) : ?> <a href="<?php echo $this->helper('customer')->getLogoutUrl(); ?>" data-target-element="#header-account" class ="skip-link skip-account"> <span class="icon"></span> <span class="label"><?php echo $this->__('Logout'); ?></span> </a> <?php endif; ?>
hinter
<a href="<?php echo $this->helper('customer')->getAccountUrl(); ?>" data-target-element="#header-account" class ="skip-link skip-account"> <span class="icon"></span> <span class="label"><?php echo $this->__('Account'); ?></span> </a>
a.
Of course, the icon would have to be adjusted. This is just a copy of the account links with adaptation for use as logout link.
A contribution how to integrate a mini log-in area in the side, there here.
Used in Magento Version 1.9 Comments? Additions? Notes? Gladly!