I noticed when i complete payment and returns to the site, it goes to the default page (english in my case)
But users can checkout in 3 different languages (Dutch/German/English)

Now when i complete payment in Dutch or maybe German it returns to the English complete page.
(perhaps this is a issue because my payment isn't working correct yet: http://drupal.org/node/1070384 but i guess it would also do the same when it should work correct?)

Comments

jurgenhaas’s picture

Not sure to be honest. It may depend on the way how languages are negotiated in your setup but I'm not an expert in that area.

What happens when the session comes back from the payment provider is that the function uc_pnag_payment_success() calls drupal_goto('cart/checkout/complete'); I would have expected drupal_goto to redirect the session to the page in the right language. But again, I'm not sure how languages are handled in your setup.

janton’s picture

i use the i18 module with the Path prefix only.

i noticed the same thing when i cancel my payment, it then returns to the default language /cart/checkout and not nl/cart/checkout

with the ideal drupal plugin for example it returns to the correct language..(or more the correct prefix) i will check there code now:
http://drupal.org/project/uc_ideal_pro

janton’s picture

straingly ideal pro module works the same, but returns in the correct prefix.
They also use: drupal_goto('cart');

But i'm not a programmer but just a starter in all this, so i think i won't find where it goes wrong, or should be different.
I also tested the paypal module and this also works correct with the pathprefix

jurgenhaas’s picture

Another difference I have found is that with iDeal they always submit an individual return URL to iDeal and it could well be that this URL already includes the language specific part in the URL.

With Payment Network the return URL is stored in the project profile on their site and can not be changed individually.

Not sure if this analysis is fully correct but I can't think of anything else right now.

janton’s picture

jurgenhaas thx, i see you mean the abort and succes link?
i see you can add "Possible replacement variables"
so i will check how it respons if i change the url with the right prefix... but i don't know how to add information to -USER_VARIABLE_1- so you get this:

https://www.domain.com/-USER_VARIABLE_1-cart/uc_pnag/payment/success?ord...
https://www.domain.com/-USER_VARIABLE_1-cart/uc_pnag/payment/cancel

but then we need to add user language in that variable.. and i have no idee how to do this? (i guess it's not verry difficult)

So you add -USER_VARIABLE_1- = nl/
and when it's english or the default language i only use /

i will test now if i return to the right language.. with only changing the link

janton’s picture

ok it seems to work!

https://www.domain.com/nl/cart/uc_pnag/payment/cancel

then i return to https://www.domain.com/nl/cart/checkout

:)

now i only need to know how to add somthing in that variable... i will try to code something, only i really really sux in this.

janton’s picture

Ok i have done it :) but not the way it should be i think.. so look to my code:

uc_pnag.pages.inc

global $language;
  if ($language->language != 'en'){
  	$lang_prefix = '/'.$language->language;
	}
	
  $data = array(
    'user_id' => uc_pnag_var('user_id'),
    'project_id' => uc_pnag_var('project_id'),
    'amount' => uc_price($order->order_total, $context, $options),
    'currency_id' => variable_get('uc_currency_code', 'EUR'),
    'reason_1' => 'Order No. '. $order->order_id .'-'. $order->uid,
    'reason_2' => variable_get('uc_store_name', 'Online Shop'),
    'language_id' => _uc_pnag_language(),
    'sender_holder' => '',
    'sender_account_number' => '',
    'sender_bank_code' => '',
    'sender_country_id' => '',
    'user_variable_0' => $order->order_id,
    'user_variable_1' => $lang_prefix,
    'user_variable_2' => '',
    'user_variable_3' => '',
    'user_variable_4' => '',
    'user_variable_5' => 'Shop-System Name v.2.0',
  );

https://www.domain.com-USER_VARIABLE_1-/cart/uc_pnag/payment/success?ord...
https://www.domain.com-USER_VARIABLE_1-/cart/uc_pnag/payment/cancel

I think it should be done different.. but it works for me.. but i think i should add the code in somekind of function? i now just typed it above the $data = array

janton’s picture

i found another problem, but i will open a new ticket for this.. (it's not connected with this ticket but it had to do with languages)

jurgenhaas’s picture

Have you tested it, does it work this way? Do you get redirected properly to the correct page in the correct language after you have completed or canceled your payment?

janton’s picture

Yes i tested this and it works perfect! (for me)
only i think it should be done different if you want to include such thing in this module.
So it also works correct if a user has a different default language then English
Because i now say in the code that the $language->language != 'en'
Also what if a user doesn't have languages (i18 module) well then i guess that line is also not triggered but...
also i'm not 100% sure $language->language will show all correct prefixes, for Dutch and German and Frans it did.. but i'm not sure how prefixes are created

But this is a good start! (i think)

jurgenhaas’s picture

Status: Active » Postponed

OK, let's see if others will come up with similar requirements

jurgenhaas’s picture

Status: Postponed » Closed (won't fix)

Looks like this is very old and no replies since, so I'm going to close this. Another reason for this is that we've release new releases for Ubercart 2 and 3 and things have changed there a lot, so this older one most certainly doesn't apply anymore.

jurgenhaas’s picture

Issue summary: View changes

i thought i could add a link for drupal ticket with #1070384 but it did not work so i will give the full link http://drupal.org/node/1070384