Magento-1.9 – Hide Current Flag from Language Selector

languagemagento-1.9store-view

Our shop has two store views. One is Dutch the other is English. We use the following code to show the flags to choose a view.

<?php if (count($this->getStores()) > 1): ?>
    <div class="form-language">
        <div class="langs-wrapper">
            <?php foreach ($this->getStores() as $_lang): ?>
                <?php $selected = $_lang->getId() == $this->getCurrentStoreId() ?>
                <a class="lang-flag<?php $selected && print ' selected' ?>" href="<?php echo $_lang->getCurrentUrl() ?>">
                    <img src="<?php echo $this->getSkinUrl('images/flags/' . $_lang->getCode() . '.png');?>"
                        alt="<?php echo $this->htmlEscape($_lang->getName()) ?>">
                </a>
            <?php endforeach ?>
        </div>
    </div>
<?php endif ?>

Now we want to hide the flag for the current language. Because you don't need to see that. How can we create this?

Best Answer

In css you could add .lang-flag.selected {display: none;}