grad Posted June 25, 2013 Share Posted June 25, 2013 Hi, I'm italian developer and I apologize to you for my non-perfect english. I have a question: I would like to visualize different page for one product depending a language. For example, in italian language I visualize a product in a determinate mode and in russian language in another one mode. Thank you for your time, see you later grad Link to comment Share on other sites More sharing options...
vekia Posted June 25, 2013 Share Posted June 25, 2013 it is ofcourse possible but after modifications to front controller, everything depends on prestashop version that you use, so please give us information about your PS version. Link to comment Share on other sites More sharing options...
grad Posted June 25, 2013 Author Share Posted June 25, 2013 thanks for the reply! I use the latest version: 1.5.4.1 Link to comment Share on other sites More sharing options...
vekia Posted June 25, 2013 Share Posted June 25, 2013 go to the controllers/front/ProductController.php this is a product page controller. okay, you've got there function: public function initContent() at the end of this function you've got [ near the line 280 ] $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); instead this one use: if ($this->context->cookie->id_lang==1){ $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } if ($this->context->cookie->id_lang==2){ $this->setTemplate(_PS_THEME_DIR_.'product-fr.tpl'); } if ($this->context->cookie->id_lang==3){ $this->setTemplate(_PS_THEME_DIR_.'product-it.tpl'); } where the: $this->context->cookie->id_lang==1 1 - is an id of the language $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); product.tpl is a template file related to the language as you can see, i use different templates for different id_lang values. just do the same. will work :-) 1 Link to comment Share on other sites More sharing options...
grad Posted June 26, 2013 Author Share Posted June 26, 2013 Thank you very much! It's very very great explanation!!! Now, I try this solution! Thank you again! Link to comment Share on other sites More sharing options...
vekia Posted June 26, 2013 Share Posted June 26, 2013 if you've got any questions related to this thread - feel free to write, I really like modifications like this so i will help don't forget to let us know if everything works for you as you expect 1 Link to comment Share on other sites More sharing options...
grad Posted June 26, 2013 Author Share Posted June 26, 2013 Thanks again! It's work! Well, i have another question. Can I change some colors? If is possible, I think that the colors is in the css file, where is it? For example: In italian language i would like to see the "more info" bar in green while in brazilian i would like to see in green. I attach an image that represent the "more info" bar. Thanks, grad Link to comment Share on other sites More sharing options...
vekia Posted June 26, 2013 Share Posted June 26, 2013 well it is possible but everything depends on css styles. in this case you have to create different styles for each language version 1) create new styles in global.css 2) change class="" etc. in the .tpl file for which you want to apply new style. Link to comment Share on other sites More sharing options...
irina.clington Posted October 21, 2014 Share Posted October 21, 2014 go to the controllers/front/ProductController.php this is a product page controller. okay, you've got there function: public function initContent() at the end of this function you've got [ near the line 280 ] $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); instead this one use: if ($this->context->cookie->id_lang==1){ $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } if ($this->context->cookie->id_lang==2){ $this->setTemplate(_PS_THEME_DIR_.'product-fr.tpl'); } if ($this->context->cookie->id_lang==3){ $this->setTemplate(_PS_THEME_DIR_.'product-it.tpl'); } where the:$this->context->cookie->id_lang==1 1 - is an id of the language $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); product.tpl is a template file related to the language as you can see, i use different templates for different id_lang values. just do the same. will work :-) Hi, I have an issue regarding this solution, I've changed the controller in order to have a different product.tpl page when a product is customizable. if (is_array($customizationFields)) { $this->setTemplate(_PS_THEME_DIR_.'custproduct.tpl'); } else { $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } But when my custproduct.tpl page is displayed the portuguese translations arent't shown. the labels appear in english. Could you please help me out? Kind regards, Irina 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