casitto Posted October 8, 2013 Share Posted October 8, 2013 Hi, I have PS 1.3.6, how I can adapting blocklanguages for do it this: - when I click on a language flag I would open a custom URL (external) this is the code of blocklanguages <!-- Block languages module --> <div id="languages_block_top"> <label>{l s='Languages' mod='blocklanguages'}:</label> <ul id="first-languages"> {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}<a href="{$link->getLanguageLink($language.id_lang, $language.name)}" title="{$language.name}">{/if} <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> {if $language.iso_code != $lang_iso}</a>{/if} </li> {/foreach} </ul> </div> <script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.55); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.55); {rdelim}); </script> <!-- /Block languages module --> thanks Link to comment Share on other sites More sharing options...
vekia Posted October 8, 2013 Share Posted October 8, 2013 for example: {if $language.iso_code == "en"} <a href="HTTP://MYLINK.COM" title="{$language.name}"> Link to comment Share on other sites More sharing options...
casitto Posted October 8, 2013 Author Share Posted October 8, 2013 (edited) hi, where I add this code ? If I add in blocklanguages.tpl, nothing change Edited October 8, 2013 by casitto (see edit history) Link to comment Share on other sites More sharing options...
casitto Posted October 9, 2013 Author Share Posted October 9, 2013 anyone ? Link to comment Share on other sites More sharing options...
vekia Posted October 9, 2013 Share Posted October 9, 2013 hello make sure that your theme does not override this file if you've got themes/YOUR_THEME/modules/blocklanguages/blocklaguages.tpl file you have to edit this one. in addition to this, turn on force compile under adv. parameters > performance tab (and also turn cache off) moreover, i show you only example how to achieve what you expected, can you show how your code looks like ? Link to comment Share on other sites More sharing options...
casitto Posted October 9, 2013 Author Share Posted October 9, 2013 Hi, thanks for your replay, my code themes/YOUR_THEME/modules/blocklanguages/blocklaguages.tpl is above, I try to put inside everywhere your code but without success Link to comment Share on other sites More sharing options...
vekia Posted October 9, 2013 Share Posted October 9, 2013 and what code you use there? Link to comment Share on other sites More sharing options...
casitto Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) <!-- Block languages module --><div id="languages_block_top"> <label>{l s='Languages' mod='blocklanguages'}:</label> <ul id="first-languages"> {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}<a href="{$link->getLanguageLink($language.id_lang, $language.name)}" title="{$language.name}">{/if} <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> {if $language.iso_code != $lang_iso}</a>{/if} {if $language.iso_code == "en"}<a href="HTTP://MYLINK.COM" title="{$language.name}"> </li> {/foreach} </ul></div><script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.55); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.55); {rdelim});</script><!-- /Block languages module --> Edited October 10, 2013 by casitto (see edit history) Link to comment Share on other sites More sharing options...
casitto Posted October 10, 2013 Author Share Posted October 10, 2013 I try also this: <!-- Block languages module --><div id="languages_block_top"> <label>{l s='Languages' mod='blocklanguages'}:</label> <ul id="first-languages"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}> {if $language.iso_code == "en"}<a href="HTTP://MYLINK.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> {if $language.iso_code != $lang_iso}</a>{/if} </li> {/foreach} </ul></div><script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.55); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.55); {rdelim});</script><!-- /Block languages module --> I'm sorry but code don't work in edit option... Link to comment Share on other sites More sharing options...
vekia Posted October 10, 2013 Share Posted October 10, 2013 your code doesn't work, use this one: <!-- 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}" 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 == "en"} <a href="HTTP://MYLINK.COM" title="{$language.name}"> don't forget to define urls to other languages, for now - you've got here only english language: {if $language.iso_code == "en"} Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 Hi, I think your code is incomplete, maybe the problem at the code fuction of the forum Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 ohh you've got right, something bad went here :| <!-- 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}" 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 == "en"} <a href="HTTP://MYLINK.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> {/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 --> Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 (edited) Hi, I try to put your entire code but nothing change, I change the URL of my website and the language ISO code tested in chrome e firefox Edited October 11, 2013 by casitto (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 Hi, I try to put your entire code but nothing change it mean that your store displays cached file (clear shop cache) or that you changed wrong file - does file themes/YOUR_THEME/modules/blocklanguages/blocklanguages.tpl exist? Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 after clear the cache the index file is blank ! my PS version is 1.3.6 maybe for this reason ? Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 yes... definitely. i pasted code for 1.5.x sorry, by bad im going to install 1.3.6 version and i will prepare solution for you Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 WOW, thank you very much !! Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 ok im back here is the code for blocklanguages.tpl for 1.3.6 version with modifications: <!-- Block languages module --> <div id="languages_block_top"> <ul id="first-languages"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}> {if $language.iso_code == "en"} <a href="HTTP://united_kingdom.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} {if $language.iso_code == "es"} <a href="HTTP://spain.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} {if $language.iso_code == "fr"} <a href="HTTP://france.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} </li> {/foreach} </ul> </div> <script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.3); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.3); {rdelim}); </script> <!-- /Block languages module --> i added 3 if conditions to check english, spain, and france language versions Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 my language are ITALIAN (it) and JAPANESE (ja) Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 <!-- Block languages module --> <div id="languages_block_top"> <ul id="first-languages"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}> {if $language.iso_code == "jp"} <a href="HTTP://japanese.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} {if $language.iso_code == "it"} <a href="HTTP://italian.COM" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} </li> {/foreach} </ul> </div> <script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.3); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.3); {rdelim}); </script> <!-- /Block languages module --> of course you have to define own links to websites, instead of HTTP://japanese.COM and HTTP://italian.COM just use own correct urls Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 (edited) with this code:<!-- Block languages module --><div id="languages_block_top"> <ul id="first-languages"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}> {if $language.iso_code == "jp"} <a href="HTTP://mysite.jp" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} {if $language.iso_code == "it"} <a href="HTTP://www.mysite.com" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} </li> {/foreach} </ul></div><script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.3); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.3); {rdelim});</script><!-- /Block languages module --> the japanese flag disappears, the italian flag is ok Edited October 11, 2013 by casitto (see edit history) Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 I change the japanese ISO code (ja), but still same error... Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 can you share url to yur website? i will inspect it Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 ok, iso code for japan version is ja: {if $language.iso_code == "ja"} <a href="HTTP://mysite.jp" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} have you cleared cache once again (after changes) ? Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 yes, I have already change iso code in "JA" and clear the cache, but still only the italian flag Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 "JA" isn't the same as "ja" in this case if condition is Case Sensitive Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 I mean "ja" this is the code I use now, the japanese flag disappear <!-- Block languages module --><div id="languages_block_top"> <ul id="first-languages"> {foreach from=$languages key=k item=language name="languages"} <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}> {if $language.iso_code == "ja"} <a href="HTTP://mysite.jp" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} {if $language.iso_code == "it"} <a href="HTTP://www.mysite.com" title="{$language.name}"> <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" /> </a> {/if} </li> {/foreach} </ul></div><script type="text/javascript"> $('ul#first-languages li:not(.selected_language)').css('opacity', 0.3); $('ul#first-languages li:not(.selected_language)').hover(function(){ldelim} $(this).css('opacity', 1); {rdelim}, function(){ldelim} $(this).css('opacity', 0.3); {rdelim});</script><!-- /Block languages module --> Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 have you got japan language defined in your store? it looks like not Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 yes, but I don't install the ja.gzip because before changing the code the flags were properly Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 (edited) Ah now is ok also there is a warning, but I don't need install the language gzip The last thing is: how I can display the word: "language" before the flags? Edited October 11, 2013 by casitto (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 add: <span style="display:inline-block;float: left;padding-right: 10px;">{l s='languages' mod='blocklanguages'}</span> right before the <ul id="first-languages"> in your code Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 vekia you are a TRUE LEGEND of Prestashop ! Thank you very much for your support, you are very friendly and knowledgeable Thank you again Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 you're welcome glad to hear that i could help you a little in this case it's time to mark this topic as [solved] with regards, Milos Link to comment Share on other sites More sharing options...
casitto Posted October 11, 2013 Author Share Posted October 11, 2013 yes sir Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now