Call-back icon  Sales: Call 800.374.8146 (N America)|757.278.0920 (International)

Magento

Open Source eCommerce Evolved

Magento Forum

   
How do I change language drop down into languages flags ? 
 
Loïc
Member
 
Avatar
Total Posts:  52
Joined:  2007-12-19
Paris, France
 

I’ve try to use page/switch/flags.phtml but I get an error and the site freeze.
Any idea ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  47
Joined:  2007-08-31
Paris, France
 

I’ve just taken languages.phtml as a starting point and I’ve ended with:

<?php if(count($this->getStores())>1): ?>
<div class="language-switcher">
    
<?php foreach ($this->getStores() as $_lang): ?>
        
<a href="setLanguageCode('<?php echo $_lang->getCode() ?>', '<?php echo $this->getCurrentStoreCode()?>')"><img src="<?php echo $this->getSkinUrl('images/flag_' . $this->htmlEscape($_lang->getName()) . '.gif') ?>" width="21" height="14" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/></a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Loïc
Member
 
Avatar
Total Posts:  52
Joined:  2007-12-19
Paris, France
 

Thank you for your answer, I’ll try this and let you know. !
Merci merci smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Loïc
Member
 
Avatar
Total Posts:  52
Joined:  2007-12-19
Paris, France
 

It works but didn’t switch languages…
So I modified your code like this :

<?php if(count($this->getStores())>1): ?>
<div class="language-switcher">
    
<?php foreach ($this->getStores() as $_lang): ?>
        
<a href="?store=<?php echo $_lang->getCode() ?>&from;_store=<?php echo $this->getCurrentStoreCode()?>"><img src="<?php echo $this->getSkinUrl('images/flag_' . $this->htmlEscape($_lang->getName()) . '.gif') ?>" width="21" height="14" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/></a>
    
<?php endforeach; ?>
</div>
<?php endif; ?> 

<?php

And now it switches, but I don’t know if it’s correct.

If anyone is interested, Icon Flags can be found here

 
Magento Community Magento Community
Magento Community
Magento Community
 
Black Cat
Guru
 
Avatar
Total Posts:  686
Joined:  2008-02-14
Gonnesa (Italy)
 

there is a correct solution?

 Signature 

Cerchi un Webdesigner o grafico per Magento? Contattami

Maintainer Traduzione Italiana
Moderatore Forum Italiano Magento
Magento Webdesigner

-------------My Blog--------------

 
Magento Community Magento Community
Magento Community
Magento Community
 
manu2008
Jr. Member
 
Total Posts:  12
Joined:  2008-05-27
 

Works fine Loic, merci for your input, great stuff!!
Manu

 
Magento Community Magento Community
Magento Community
Magento Community
 
Joerg
Jr. Member
 
Total Posts:  9
Joined:  2008-06-04
 

The above code works fine, but it didn’t observe the correct URL naming with store codes. So here’s an improved version:

<?php if(count($this->getStores())>1): ?>
<div class="language-switcher">
    
<?php foreach ($this->getStores() as $_lang): ?>
        
<a href="<?php echo $_lang->getCurrentUrl() ?>"><img
src
="<?php echo $this->getSkinUrl('images/flag_' . $this->htmlEscape($_lang->getName()) . '.gif') ?>" width="16" height="11"
alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/></a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>

Hope that helps somebody… grin

Joerg.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brianpat
Jr. Member
 
Total Posts:  19
Joined:  2008-04-05
 

It doesn’t show the flags. What would be the name of the flags image in /image directory. I have the naming like flag_en for english and flag_fr for frnch.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Black Cat
Guru
 
Avatar
Total Posts:  686
Joined:  2008-02-14
Gonnesa (Italy)
 

to my installation, the name of flags is es: English.gif Oo

 Signature 

Cerchi un Webdesigner o grafico per Magento? Contattami

Maintainer Traduzione Italiana
Moderatore Forum Italiano Magento
Magento Webdesigner

-------------My Blog--------------

 
Magento Community Magento Community
Magento Community
Magento Community
 
Loïc
Member
 
Avatar
Total Posts:  52
Joined:  2007-12-19
Paris, France
 

Thank you so much Joerg !!!!
Works perfect (V1.1.2) !!!

@ brianpat : your gif must be named like your storeviews (i.e. mystoreviewEnglish.gif for example)

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 800.374.8146 (North America) 757.278.0920 (International)
© Copyright 2008 Varien. Magento is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
33578 users|295 users currently online|74531 forum posts