Skip to content

Instantly share code, notes, and snippets.

@nflint
Created December 2, 2015 20:59
Show Gist options
  • Save nflint/ce2d3fd6cfbcb3b26ffc to your computer and use it in GitHub Desktop.
Save nflint/ce2d3fd6cfbcb3b26ffc to your computer and use it in GitHub Desktop.
M7 Magento Language Changer
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category design
* @package base_default
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Language switcher template
*
* @see Mage_Page_Block_Switch
*/
?>
<?php
$store = Mage::app()->getStore();
$code = $store->getCode();
$lang_flag = Mage::getStoreConfig('zebra_settings/header/language_flag', $code);
?>
<?php if(count($this->getStores())>1): ?>
<div class="form-language top-select">
<ul>
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_active = ($_lang->getId() == $this->getCurrentStoreId()) ? ' class ="active"' : '' ?>
<li <?php echo $_active; ?>>
<a href="<?php echo $_lang->getCurrentUrl() ?>"> <?php echo $this->htmlEscape($_lang->getName()) ?>
<?php if($lang_flag): ?> <img src= "<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.png'); ?>" >
<?php endif; ?>
<?php //echo $_selected ?>>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.png'); ?>
<?php endif; ?>
<?php //echo $_selected ?>>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment