Reputation: 3824
I have the following (incredibly basic) language links in my Magento 1.7 store.
<div class="language-selection">
<a href="?___store=ana_mas_spain_store_view_english">English</a> |
<a href="?___store=ana_mas_spain_store_view_spanish">Spanish</a>
</div>
What would be the easiest way to hide the currently selected language? So if the user clicked Spanish, the only text link that remains would be the English link.
Any pointers would be appreciated.
Upvotes: 0
Views: 481
Reputation: 680
You can try it:
<div class="language-selection">
<?php
$allStores = Mage::app()->getStores();
$currStoreId = Mage::app()->getStore()->getStoreId();
foreach ($allStores as $_id => $val) {
if (Mage::app()->getStore($_id)->getId() != $currStoreId) {
echo sprintf('<a href="?___store=%s">%s</a>', Mage::app()->getStore($_id)->getCode(), Mage::app()->getStore($_id)->getName());
}
}
?>
</div>
Upvotes: 2