Saturday, November 26, 2011

magento country flag

Magento is a new professional open-source eCommerce solution offering unprecedented flexibility and control. To show country flags in website header or footer section. Quick and easy steps to add country flags in header / footer are as follows.

< ?php if(count($this->getGroups())>1): ?>
<div id="countrySelector" class="w940 mT10">
<ul>
< ?php foreach ($this->getGroups() as $_group): ?>
<li>
<a alt="<?php echo $this->htmlEscape($_group->getName()) ?>" hre="" f="< ?php echo $_group->getHomeUrl(); ?>">
<img sr="" c="<?php echo $this-/>getSkinUrl('images/flag' . $this->htmlEscape($_group->getName()) . '.png') ?>" alt="< ?php echo $this->htmlEscape($_group->getName()) ?>" height="18" width="26">
</a>
</li>

< ?php endforeach; ?>
</ul>
</div>

< ?php endif; ?>

Step 2: Now add entry into page.xml file and file header block i.e. “html_header”. In case if you want to add flags in footer section then search for footer block and add following line in footer and do little css to align it correctly. Step 3: Upload flag images into “skin/frontend/currentTheme/images/” directory and make sure the flag file names are having store name is part of flag name. (i.e. Image name is “flagEnglish.gif”, “flagGerman.gif”. So store names are “English”, “German”, etc) Now clean the magento cache and reload the home page and you are done!!. In case if you are not able to see the flags then let me know, i would love to help you.

No comments: