sandokan71 Posted June 21, 2012 Share Posted June 21, 2012 Hello, I installed the prestashop ogone module which I'm testing right now. Everything works fine so far but I'm struggling with one little problem and would need some help from a pro out there. Ogone allows to link their payment process page to a custom template which can be hosted on your server. This can be done through adding the right param (in red) in ogone.php page like this: public function hookPayment($params) { global $smarty; $currency = new Currency((int)($params['cart']->id_currency)); $lang = new Language((int)($params['cart']->id_lang)); $customer = new Customer((int)($params['cart']->id_customer)); $address = new Address((int)($params['cart']->id_address_invoice)); $country = new Country((int)($address->id_country), (int)($params['cart']->id_lang)); $ogoneParams = array(); $ogoneParams['PSPID'] = Configuration::get('OGONE_PSPID'); $ogoneParams['OPERATION'] = 'SAL'; $ogoneParams['ORDERID'] = pSQL($params['cart']->id); $ogoneParams['AMOUNT'] = number_format(Tools::convertPrice((float)(number_format($params['cart']->getOrderTotal(true, Cart::BOTH), 2, '.', '')), $currency), 2, '.', '') * 100; $ogoneParams['CURRENCY'] = $currency->iso_code; $ogoneParams['LANGUAGE'] = $lang->iso_code.'_'.strtoupper($lang->iso_code); [color=#ff0000] $ogoneParams['TP'] = Tools::getHttpHost(true).'/presta/payment.php';[/color] ................... $smarty->assign('ogone_params', $ogoneParams); $smarty->assign('OGONE_MODE', Configuration::get('OGONE_MODE')); return $this->display(__FILE__, 'ogone.tpl'); } Now the problem is that my payment.php page is always loading in the shop's default language. As I have a 3 language shop I would like to retrieve the right page according to the customers choosen language. What do I have to add to the /presta/payment.php to retrieve the language (id_lang or cookie ?). I know how to do it in a tpl file but I've very limited php programming skills. Hope someone can help me out on this...Thanks in advance Link to comment Share on other sites More sharing options...
bellini13 Posted June 22, 2012 Share Posted June 22, 2012 (edited) the language is already in that code snipet. $lang = new Language((int)($params['cart']->id_lang)); $lang is the Language object, so you can get the iso code by doing this $isoCode=$lang->iso_code; Edited June 22, 2012 by bellini13 (see edit history) Link to comment Share on other sites More sharing options...
sandokan71 Posted June 22, 2012 Author Share Posted June 22, 2012 (edited) Hi bellini, Thanks for your answer but unfortunatly this doen't work. What I need is to retrieve the id_lang part and add it to the url. Example : If my php code is like this : $ogoneParams['TP'] = Tools::getHttpHost(true).'/presta/payment.php'; it will parse and send this in html: http://www.myshop.com/presta/payment.php But what I would need is : http://www.myshop.com/presta/payment.php?&id_lang=1 and where the Id_lang number is dynamically retrieved from the php code according to the language id's from the backoffice Edited June 22, 2012 by sandokan71 (see edit history) Link to comment Share on other sites More sharing options...
sandokan71 Posted June 22, 2012 Author Share Posted June 22, 2012 Ok...Thanks Bellini. You gave me the hint to solve it. This is how the code has to be to do what I wanted: $ogoneParams['TP'] = Tools::getHttpHost(true).'/presta/payment.php?id_lang='.$params['cart']->id_lang; 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