I have Magento 22.214.171.124 CE installed in one of my client's site which is multistore site.
Now I have following code in header file for checking whether a customer is logged in or not using session model and showing appropriate login/logout links as per condition.
<?php foreach($_storeArr as $store): $storeBaseUrl = Mage::app()->getStore($store['id'])->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); $helper = Mage::helper('customer'); $custSession = Mage::getModel('customer/session'); ?> <li> <?php if ($custSession->isLoggedIn()): ?> <a href="<?php echo $storeBaseUrl.'customer/account/logout'; ?>"><?php echo $this->__('Logout ').$store['name']; ?></a> <?php else: ?> <a href="<?php echo $storeBaseUrl.'customer/account/login'; ?>"><?php echo $this->__('Login ').$store['name']; ?></a> <?php endif; ?> </li> <?php endforeach; ?>
But I want to show both store's login links such that if a customer is logged in any store it would show logout link only for that store.
Right now it shows logout link for both stores, even if a customer is logged in any store.
Can anyone guide on this ?