sickshot Posted March 24, 2014 Share Posted March 24, 2014 (edited) Hello i have an image in tpl: <img class="delicon" src="/themes/prestashop/img/deliver.png"></a> is it possible to display different image according to selected language? TIA Edited March 24, 2014 by sickshot (see edit history) Link to comment Share on other sites More sharing options...
flobrflo Posted March 24, 2014 Share Posted March 24, 2014 you can access to id lang with smarty. So you can name your image with id_lang, like: <img class="delicon" src="/themes/prestashop/img/deliver_1.png"></a> <img class="delicon" src="/themes/prestashop/img/deliver_2.png"></a> //if you want 2 images differents enter 2 lang So you can assign to smarty the id_lang: $this->context->smarty->assign('id_lang', $this->context->language->id); and call your img after : <img class="delicon" src="/themes/prestashop/img/deliver_{$id_lang}.png"></a> Link to comment Share on other sites More sharing options...
sickshot Posted March 24, 2014 Author Share Posted March 24, 2014 (edited) flobrflo thank you for reply, but I dont understand where to place this, i mean which file : So you can name your image with id_lang, like: <img class="delicon" src="/themes/prestashop/img/deliver_1.png"></a><img class="delicon" src="/themes/prestashop/img/deliver_2.png"></a>//if you want 2 images differents enter 2 langSo you can assign to smarty the id_lang: $this->context->smarty->assign('id_lang', $this->context->language->id); my image is in block user info tpl Edited March 24, 2014 by sickshot (see edit history) Link to comment Share on other sites More sharing options...
sickshot Posted March 24, 2014 Author Share Posted March 24, 2014 (edited) ok I solved this: if image is called delivery - create 2 images called delivery_en.png and delivery_fr.png (according to your language code) and insert this code: <img src="{$img_dir}deliver_{$lang_iso}.png" alt="{l s='delivery}" img class="delivery"/> Edited March 24, 2014 by sickshot (see edit history) 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