Wednesday, October 17, 2012

magento language switch code

<?php if(count($this->getStores())>1): ?>
<div class="form-language">
    <label><?php echo $this->__('Language:') ?></label>
    <ul>
    <?php foreach ($this->getStores() as $_lang): ?>
        <?php
            $tam    =    $this->htmlEscape($_lang->getName());
            $ten    =    substr($tam,0,2);
        ?>
        <?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? 'selected    ' : '' ?>
        <li class="<?php echo  $_selected ?>"><a href="<?php echo $_lang->getCurrentUrl() ?>"><?php echo $ten ?></a></li>
    <?php endforeach; ?>
    </ul>
    <script type="text/javascript">decorateGeneric($$('.form-language ul li'), ['first','last'])</script>
</div>
<?php endif; ?>


No comments:

Post a Comment