Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Currency Auto Set according to Zone?


DJStealth

Recommended Posts

Posted

Hi,

 

I have a client that wants to use 2 currencies (CAD and USD).

 

They want to charge most of the world in USD, and Canadians in CAD.

 

We don't want non-Canadians requesting CAD, and Canadians requesting USD. So rather than the currency selection option, we want it to automatically select the currency (and charge) based on the user's Zone.

 

If it makes anything easier, we're using an exchange rate of 1.00 CAD = 1.00 USD.

 

Any suggestions?

Posted

I suppose you could do something quick and dirty like the following:-

 

catalog/includes/application_top.php

 

Find ..

 

	if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
  $currency = $HTTP_GET_VARS['currency'];
} else {
  $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
 }

 

Add immediately below ..

 

  if( tep_session_is_registered('customer_country_id') && $_SESSION['customer_country_id'] == '38' ){
$currencies->is_set('CAD');
 }

 

The above is based on 38 being the country id for Canada in your shop, CAD being the code for Canadian dollars and USD being set as the standard default.

Posted

Thanks for the help.

 

I just realized, I'm going to need to fix my payment module also to handle multiple currencies, but I think I figured out how to do that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...