Posted by ntigh52 on December 25, 2011 at 2:07pm
5 followers
Jump to:
| Project: | Commerce PayPal |
| Version: | 7.x-1.x-dev |
| Component: | PayPal WPS |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi to all,
how can I define to PayPal login page language IL?
this option not Appears.>
Thanks/
Comments
#1
Hi,
I added the il on:
commerce_paypal_wps.module
function commerce_paypal_wps_languages() {return drupal_map_assoc(array('AU', 'DE', 'FR', 'IT', 'GB', 'ES', 'US', 'IL'));
}
tha , 'IL' in the end of array, and its work!
rszrama, Thanks again.
#2
I run a multi language + multi currency website.
How can I get the module to send the visitors to the right PayPal WPS country site depending on the site language?
As of now, I believe we can only choose 1 PayPal screen language within the admin settings.
Basically, the URL differs depending on the country code specified within the URL:
Thanks
#3
@teebow,
You'd have to change the commerce_paypal_wps_server_url function into this:
<?php
function commerce_paypal_wps_server_url($server) {
global $language ;
$lang = strtoupper($language->language);
switch ($server) {
case 'sandbox':
return 'https://www.sandbox.paypal.com/' . $lang . 'cgi-bin/webscr';
case 'live':
return 'https://www.paypal.com/' . $lang . 'cgi-bin/webscr';
}
}
?>
Also, the settings for language appears to do nothing at this point. You'd have to do something like this to make the settings take effect:
<?php
function commerce_paypal_wps_server_url($server) {
$pm = commerce_payment_method_instance_load('paypal_wps|commerce_payment_paypal_wps');
$lang = $pm['settings']['language'];
switch ($server) {
case 'sandbox':
return 'https://www.sandbox.paypal.com/' . $lang . 'cgi-bin/webscr';
case 'live':
return 'https://www.paypal.com/' . $lang . 'cgi-bin/webscr';
}
}
?>
#4
@Toxid
Hi, i'm also using a multi currency and multi lingual site.
I tried your code, but it doesnt work on my side. paypal login page is still selected from the lang menu..
#5
You're right, it seems that paypal only offers a limited amount of languages for login pages. If you try 'de' you get the german page. So it seems that the problem is on paypals end.
#6
Yes, in fact I've just updated the list of supported languages and locales within the WPS module in this issue: [#]
You're not supposed to pass the parameter in via the URL but as part of the form (specifically the lc parameter). This only supports a subset of languages and locales, and those are now all represented as options on the settings form. As to the question above about selecting a different PayPal login page based on the current user's language, I think the best thing to do right now will be to alter the PayPal WPS parameters yourself using hook_commerce_paypal_wps_order_form_data_alter() (described in commerce_paypal_wps.api.php) to use whatever lc value you want based on your site's configuration.
I'm going to repurpose this as a feature request, though, to change the login page language based on the current user's language, but it's going to require more than a simple mapping of Drupal language codes since PayPal doesn't support every language and uses some customer 5 character codes for certain locales. We'll have to detect the current language, see if it maps to a known PayPal language, and change the lc parameter accordingly; otherwise we'll just leave it at the configured default login page language.