kingsinnersoul Posted June 12, 2013 Share Posted June 12, 2013 Hello, I am using PS 1.5.4 default theme, and I am adding a facebook "Like" button, and I want to display different buttons for differnet languages. Official facebook page says that I just need to change a one liner. I have tried adding {if} inside the javescript, but it did not work. I have tried the following, but it does not work. Can someone pleae help me? <li id="share_facebook"> <div id="fb-root"></div> {if ($iso_code == 'en')} {literal} <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=386759271445638"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> {/literal} {elseif ($iso_code == 'ru')} {literal} <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1&appId=386759271445638"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> {/literal} {elseif ($iso_code == 'fr')} {literal} <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1&appId=386759271445638"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> {/literal} {elseif ($iso_code == 'mx')} {literal} <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=386759271445638"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> {/literal} {/if} <div class="fb-like" data-send="false" data-layout="box_count" data-width="280px" data-show-faces="false" data-font="arial" border-radius="3px 3px 3px 3px" > </div> </li> Thank you Link to comment Share on other sites More sharing options...
vekia Posted June 12, 2013 Share Posted June 12, 2013 are you sure that variable with language iso code exist? ( $iso_code ) Link to comment Share on other sites More sharing options...
kingsinnersoul Posted June 12, 2013 Author Share Posted June 12, 2013 I had a code before hand that was "trying" to read the current language into $iso_code. But I have tried $language.iso_code and $lang_iso, and I get nothing back. I am not sure if I am using the wrong variable, or if I am using wrong smarty context :-( Link to comment Share on other sites More sharing options...
vekia Posted June 12, 2013 Share Posted June 12, 2013 in my opinion, its better to try with: $this->context->customer->id_lang - put this variable to smarty array, after that you can create {if} conditions based on language ID - not iso code (no queries to db!) 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