Jump to content

removing dropdown and display flag inline


Nikoleta

Recommended Posts

My question is if you know know how to remove the drop down and display the flags inline? want to have just two languages : one english and one bulgarian one
I go to FTP-> modules ->blocklanguages.tpl and this is the flowing code: 
<!-- Block languages module -->
{if count($languages) > 1}
<div id="languages_block_top">
<div id="countries">
{* @todo fix display current languages, removing the first foreach loop *}
{foreach from=$languages key=k item=language name="languages"}
{if $language.iso_code == $lang_iso}
<p class="selected_language">
<img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code|escape:'html':'UTF-8'}" width="16" height="11" />
</p>
{/if}
{/foreach}
<ul id="first-languages" class="countries_ul">
{foreach from=$languages key=k item=language name="languages"}
<li {if $language.iso_code == $lang_iso}class="selected_language"{/if}>
{if $language.iso_code != $lang_iso}
{assign var=indice_lang value=$language.id_lang}
{if isset($lang_rewrite_urls.$indice_lang)}
<a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$language.name|escape:'html':'UTF-8'}" rel="alternate" hreflang="{$language.iso_code|escape:'html':'UTF-8'}">
{else}
<a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$language.name|escape:'html':'UTF-8'}" rel="alternate" hreflang="{$language.iso_code|escape:'html':'UTF-8'}">
 
{/if}
{/if}
<img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code|escape:'html':'UTF-8'}" width="16" height="11" />
{if $language.iso_code != $lang_iso}
</a>
{/if}
</li>
{/foreach}
</ul>
</div>
</div>
 
<script type="text/javascript">
$(document).ready(function () {
$("#countries").mouseover(function(){
$(this).addClass("countries_hover");
$(".countries_ul").addClass("countries_ul_hover");
});
$("#countries").mouseout(function(){
$(this).removeClass("countries_hover");
$(".countries_ul").removeClass("countries_ul_hover");
});
 
});
</script>
{/if}
<!-- /Block languages module -->


 I tried to remove the existing code and use the code from the folowing link, but nothing happened ( also I clear the cache of the site in performance but not help...)
https://mypresta.eu/en/art/developer/prestashop-languages-display-flags-only.html

Please help :)
 
Edited by Nikoleta (see edit history)
Link to comment
Share on other sites

Repeat steps from tutorial and also try to add code to default-bootstrap/css/modules/blocklanguages/blocklanguages.css

And you want it right so 

#languages_block_top {
    display: inline-block;
    padding: 6px 0 0 12px;
    float:right;
}

If needed clear cache in back office > advanced preferences.

 

  1. floatright;
Link to comment
Share on other sites

Hey razaro, I follow your steps and again nothing happened, so I decide to use the easier way , with a drop down menu, but if you opened the site you will see that there is a space on the flags , when you need to choose one of the languages. Do you know how to remove this?

 

The code is :

 

<!-- Block languages module -->
{if count($languages) > 1}
<div id="languages-block-top" class="languages-block">
{foreach from=$languages key=k item=language name="languages"}
{if $language.iso_code == $lang_iso}
<div class="current">
<img alt="{$language.iso_code}" height="11" alt="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" /> {$language.name|regex_replace:"/\s\(.*\)$/":""}</span>
</div>
{/if}
{/foreach}
<ul id="first-languages" class="languages-block_ul toogle_content">
{foreach from=$languages key=k item=language name="languages"}
<li {if $language.iso_code == $lang_iso}class="selected"{/if}>
{if $language.iso_code != $lang_iso}
{assign var=indice_lang value=$language.id_lang}
{if isset($lang_rewrite_urls.$indice_lang)}
<a href="{$lang_rewrite_urls.$indice_lang|escape:'html':'UTF-8'}" title="{$language.name|escape:'html':'UTF-8'}" rel="alternate" hreflang="{$language.iso_code|escape:'html':'UTF-8'}">
{else}
<a href="{$link->getLanguageLink($language.id_lang)|escape:'html':'UTF-8'}" title="{$language.name|escape:'html':'UTF-8'}" rel="alternate" hreflang="{$language.iso_code|escape:'html':'UTF-8'}">
{/if}
{/if}
<img alt="{$language.iso_code}" height="11" alt="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" /> {$language.name|regex_replace:"/\s\(.*\)$/":""}</span>   
{if $language.iso_code != $lang_iso}
</a>
{/if}
</li>
{/foreach}
</ul>
</div>
{/if}
<!-- /Block languages module -->
 
Edited by Nikoleta (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...