Jump to content

Ogone module programming


sandokan71

Recommended Posts

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

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 by sandokan71 (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...