sillusion Posted August 14, 2018 Share Posted August 14, 2018 Hi PS Community, I'm working on a "quite complex" projet, and i'm struggling with multilingual navigation. My question is about updating Cookie Language. Here is my Prestashop 1.6.1 featuring a Wordpress area : https://www.gaston-mercier.com/pages/ (WP home FR) Multilingual nav (top right) is ok for posts, taxnomys, but i'm still in hard time for Homepage of Wordpress. Yes, i do know this is a Prestashop forum ! Here is my WP home EN : https://www.gaston-mercier.com/en/pages/ Here are some lines i already use : // catching WP lang : iso code // translating to PS wording : INT $current_lang_id // getting context $context = Context::getContext(); // assign ID value to id_lang $context->smarty->assign(array('id_lang' => $current_lang_id)); // other way to assign value $context->cookie->id_lang = $current_lang_id; WP multilingual system created WP home EN at https://www.gaston-mercier.com/pages/?lang=en so I created a redirection in PS from https://www.gaston-mercier.com/en/pages/ to https://www.gaston-mercier.com/pages/?lang=en . I thought going with /en/ may updates the PS language cookie. Sometimes it works (all content in EN), and sometimes it doesn't (content in FR). I don't understand how / why. If i go to PS home, then turn to EN, i can navigate through entire website in EN, including WP, and getting back to FR from everywhere. But switching language at this WP homepage is so cryptic ! Can anybody help ? Thanks ! :-) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 16, 2018 Share Posted August 16, 2018 I believe you using the correct code to change the Prestashop language This line is not required. $context->smarty->assign(array('id_lang' => $current_lang_id)); You just have to set the language id in the context. Also, check by adding lang object in context as mentioned in the below code. $lang_id = 2; $lang_obj = new Language($lang_id); $this->context->language = $lang_obj; $this->context->cookie->id_lang = $lang_id; 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