Loïc
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
Posted: May 19 2008
| top
laurent
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; ?>
Posted: May 19 2008
| top
| # 1
Loïc
Total Posts: 52
Joined: 2007-12-19
Paris, France
Thank you for your answer, I’ll try this and let you know. !
Merci merci
Posted: May 27 2008
| top
| # 2
Loïc
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
Posted: May 27 2008
| top
| # 3
Black Cat
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 --------------
Posted: May 29 2008
| top
| # 4
manu2008
Total Posts: 12
Joined: 2008-05-27
Works fine Loic, merci for your input, great stuff!!
Manu
Posted: June 15 2008
| top
| # 5
Joerg
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…
Joerg.
Posted: July 5 2008
| top
| # 6
brianpat
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.
Posted: July 7 2008
| top
| # 7
Black Cat
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 --------------
Posted: July 7 2008
| top
| # 8
Loïc
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)
Posted: 1 month ago
| top
| # 9