In osCommerce store which has been set up to accept payment using multiple payment modules, there are chances that you might want to accept payments in specific currencies based on payment methods. Not every payment method support all currencies.
You can change currency based on payment module selection by adding few lines of code on your checkout_confirmation.php page. Following sample code shows how you can achieve that.
Open catalog/checkout_confirmation.php page and add following code below
this require(‘includes/application_top.php’); line.
require('includes/application_top.php');
if ($HTTP_POST_VARS['payment'] == 'paypal') {
//select GBP for paypal method
$currency = 'GBP';
}elseif ($HTTP_POST_VARS['payment'] == 'payway') {
//select Aus Dollar for payway method
$currency = 'AUD';
}elseif ($HTTP_POST_VARS['payment'] == 'alertpay') {
//select Euro for alertpay method
$currency = 'EUR';
}else{
//for all of the rest US dollars
$currency = 'USD';
}
Just make sure that you have added all those currencies in your store before you attempt to set them on your checkout_confirmation page using above method.
Hope that helps.
Cheers!
Hey,
thanks for your amazing idea. If modified your idea. Please find below my idea:
// if the customer use currency
if ($HTTP_POST_VARS[‘payment’] == ‘moneyordersp’) {
//select CHF for Prepayment Swiss method
$currency = ‘CHF’;
}elseif ($HTTP_POST_VARS[‘payment’] == ‘moneyorderspeu’) {
//select EURO for Prepayment Swiss method
$currency = ‘EUR’;
}elseif ($HTTP_POST_VARS[‘payment’] == ‘moneyorder’) {
//select Euro for Prepayment Germany method
$currency = ‘EUR’;
}elseif ($HTTP_POST_VARS[‘payment’] == ‘moneyordereu’) {
//select Euro for Prepayment Europe method
$currency = ‘EUR’;
}elseif ($HTTP_POST_VARS[‘payment’] == ‘postfinance’) {
//select CHF for Postfinance method
$currency = ‘EUR’;
}else{
//for all of the rest US dollars, EURO, CHF
(($currency == ‘EUR’) || ($currency == ‘USD’) || ($currency == ‘CHF’));
}
But the payment ‘postfinance’ should accept two currencies. Do you have a solution, which works for oscommerce 2.3.3?
}elseif ($HTTP_POST_VARS[‘payment’] == ‘postfinance’) {
//select CHF for Postfinance method
$currency = ‘EUR’;
I am not sure, whether this change works fine. My other payments are paypal and clickandbuy. Both should work with all currencies:
//for all of the rest US dollars, EURO, CHF
(($currency == ‘EUR’) || ($currency == ‘USD’) || ($currency == ‘CHF’));
}
Thank you in advance for your work!
best
mattis