Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
ENABLE the flags.phtml
 
Black Cat
Mentor
 
Avatar
Total Posts:  3481
Joined:  2008-02-14
Assemini / Cagliari (Italy)
 

How do I do to activate flags.phtml to the place of languages.phtml?
I have tried but me from error…

 
Magento Community Magento Community
Magento Community
Magento Community
 
ecommerce-store
Sr. Member
 
Avatar
Total Posts:  181
Joined:  2008-04-16
Roma
 

Interest mee too, no one knows?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Black Cat
Mentor
 
Avatar
Total Posts:  3481
Joined:  2008-02-14
Assemini / Cagliari (Italy)
 

no one knows? :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Moderator
 
Avatar
Total Posts:  1655
Joined:  2007-12-14
Waterloo, ON
 

Try this:

app/design/frontend/default/YOURTHEME/layout/page.xml

Around line 58 change

<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>

to

<block type="page/switch" name="store_language" as="store_language" template="page/switch/lflags.phtml"/>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Black Cat
Mentor
 
Avatar
Total Posts:  3481
Joined:  2008-02-14
Assemini / Cagliari (Italy)
 

But is not possible!  the flags is not a switch; in fact Magento report a error..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Black Cat
Mentor
 
Avatar
Total Posts:  3481
Joined:  2008-02-14
Assemini / Cagliari (Italy)
 

up..

 
Magento Community Magento Community
Magento Community
Magento Community
 
glaDiator
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-17
 

hello black cat, any solution for showing flags.phtml instead of languages.phtml ???

 
Magento Community Magento Community
Magento Community
Magento Community
 
glaDiator
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-17
 

thanks sherrie .. got it cool smirk

 
Magento Community Magento Community
Magento Community
Magento Community
 
magFlags
Member
 
Total Posts:  45
Joined:  2008-11-02
 

Better:

<block type="page/switch" name="store_language" as="store_language" template="page/switch/flags.phtml"/>
 
Magento Community Magento Community
Magento Community
Magento Community
 
spleen - Artstore
Member
 
Avatar
Total Posts:  38
Joined:  2008-11-27
Berlin, Germany
 

So far so good, but the flags doesn’t show up.

So i tried this in the flags.phtml:

<?php if(count($this->getStores())>1): ?>
<div class="language-switcher">
    
<?php foreach ($this->getStores() as $_lang): ?>
        <?php $_selected 
= ($_lang->getId() == $this->getCurrentStoreId()) ? 'selected="selected"' '' ?>
        
<a href="[removed].href=this.value"><img src="'<?php echo $this->getSkinUrl('images/flag_'.$_lang->getCode().'.gif') ?>'"</a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>

The Flags now show up, but i don’t know how to code the the url of the shop (and please talk to me like to a 7 year old child if you talk php!)

Here you can see the project

 
Magento Community Magento Community
Magento Community
Magento Community
 
spleen - Artstore
Member
 
Avatar
Total Posts:  38
Joined:  2008-11-27
Berlin, Germany
 

i don’t go longer for this, now it’s the good old dropdown…

 
Magento Community Magento Community
Magento Community
Magento Community
 
istel
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2009-02-17
Italy
 

flags.phtml can’t work. Where are flags images?!Maybe this is still not finished… ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
spleen - Artstore
Member
 
Avatar
Total Posts:  38
Joined:  2008-11-27
Berlin, Germany
 

Here you can find flags:

http://www.famfamfam.com/lab/icons/flags/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Joris Bots
Jr. Member
 
Total Posts:  3
Joined:  2009-08-05
 

This code in app/design/frontend/default/[your skin]/template/page/switch/flags.phtml worked for me.
Flags are put in skin/frontend/default/[your skin]/images/flags/

<?php if(count($this->getStores())>1): ?>
<div class="flag-language">
    
<?php foreach ($this->getStores() as $_lang): ?>
        <?php $_selected 
= ($_lang->getId() == $this->getCurrentStoreId()) ? 'selected="selected"' '' ?>
        
<a href="<?php echo $_lang->getCurrentUrl() ?>"><img style="position: relative; top: 2px" src="<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.gif') ?>"</a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
hensen
Jr. Member
 
Total Posts:  3
Joined:  2011-04-08
 

I adjusted the flags.phtml so now it display the language images next to eachother.

Note, download the icons en place them in the skin/frontend/base/default/images/flags folder and change there names.

<?php if(count($this->getStores())>1): ?>
<div class=\"block form-language\">
    <!--<
div class=\"block-title\"><?php echo $this->__(\'Your Language:\'?></div>-->
    <
div class=\"block-content\">
          <
div class=\"flags\">
        
<?php foreach ($this->getStores() as $_lang): ?>
            <?php $_selected 
= ($_lang->getId() == $this->getCurrentStoreId()) ? \'active\' \'\' ?>
            
<class=\"language\" href=\"<?php echo $_lang->getCurrentUrl() ?>\" title=\"<?php echo $this->htmlEscape($_lang->getName()) ?>\">
                <
img class=\"<?php echo $_selected ?> \" src=\"<?php echo $this->getSkinUrl(\'images/flags/\'.$_lang->getCode().\'.png\') ?>\" alt=\"<?php echo $this->htmlEscape($_lang->getName()) ?>\"/>
            </
a>
        
<?php endforeach;?>
        
</div>
    </
div>
</
div>
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Anthony G O'Connell
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2009-09-12
Bangkok, Thailand
 

Thanks that did the trick. Here’s the code cleaned up a little

<?php if(count($this->getStores())>1): ?>
        <?php 
foreach ($this->getStores() as $_lang): ?>
            <?php $_selected 
= ($_lang->getId() == $this->getCurrentStoreId()) ? 'active' '' ?>
            
<class="flag" href="<?php echo $_lang->getCurrentUrl() ?>" title="<?php echo $this->htmlEscape($_lang->getName()) ?>">
                <
img class="<?php echo $_selected ?> " src="<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.png') ?>" alt="<?php echo $this->htmlEscape($_lang->getName()) ?>"/>
            </
a>
        
<?php endforeach;?>
<?php 
endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2