Question regarding changing global currency default

Phoca Cart - complex e-commerce extension
Alexander
Phoca Enthusiast
Phoca Enthusiast
Posts: 75
Joined: 15 Jan 2020, 17:36

Question regarding changing global currency default

Post by Alexander »

Hi Jan

This is just a question. On my site, default currency is Euro as most customers come from Europe. Second currency is Swiss Franc CHF.

Many Swiss customers don't realize that it is actually a Swiss site and don't change the currency to CHF. As prices are the same in EUR and CHF, with the current rate of exchange that hurts a little :wink:

I am now trying to fix the default currency of Phoca Cart for visitors from Switzerland to CHF and leave the rest of the world in EUR.
I don't want to use geolocation libraries. For me it is sufficient to check if a user comes from a .ch domain using php gethostbyaddr.

This is trivial to implement in the mod_phocacart_currency but this is obviously not enought. For phoca_cart and checkout the default is still EUR if I don't explicitly set the currency using the currency dropdown.

Now my question: where can I best put the gethostbyaddr code checking for .ch domain to change the global phoca currency default?

Sorry to bother you with such a customizing question. It would be very kind if you could just point me in the right direction.

Thank you very much!

Alexander

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Question regarding changing global currency default

Post by Jan »

Hi, try to see:
viewtopic.php?t=61402

So adding some detection of .ch domain before this line:

$id = 2;// my own currency

and then setting the $id to this currency should work :idea:

Jan
If you find Phoca extensions useful, please support the project
Alexander
Phoca Enthusiast
Phoca Enthusiast
Posts: 75
Joined: 15 Jan 2020, 17:36

Re: Question regarding changing global currency default

Post by Alexander »

Hi Jan

Absolutely GREAT! support for an extremely versatile and - amazingly - fee product.

Thank you very much!

Alexander
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Question regarding changing global currency default

Post by Jan »

Ok, great to hear it.
If you find Phoca extensions useful, please support the project
Alexander
Phoca Enthusiast
Phoca Enthusiast
Posts: 75
Joined: 15 Jan 2020, 17:36

Re: Question regarding changing global currency default

Post by Alexander »

Hi Jan

just implemented viewtopic.php?t=61402 on my test site. Works perfectly! I added the code to the Phoca controller.php not the template as I think changes to Phoca should be made in Phoca code.

Thank you very much.

This ticket can be sucessfully closed ;)

Alexander
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Question regarding changing global currency default

Post by Jan »

Ok, thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Question regarding changing global currency default

Post by Jan »

If you find Phoca extensions useful, please support the project
Alexander
Phoca Enthusiast
Phoca Enthusiast
Posts: 75
Joined: 15 Jan 2020, 17:36

Re: Question regarding changing global currency default

Post by Alexander »

Hi Jan
Thank you!!! Nice that you remembered my question. I will test the plugin as soon as possible.
Kind regards
Alexander
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47870
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Question regarding changing global currency default

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Alexander
Phoca Enthusiast
Phoca Enthusiast
Posts: 75
Joined: 15 Jan 2020, 17:36

Re: Question regarding changing global currency default

Post by Alexander »

Hi Jan
I would like to have Swiss CHF for visitors coming from .ch domains and EURO for the rest. So I cover at least 80% of Swiss cusomers and a lot of others.

The Plugin seems to use the installed Joomla languages. Unfortunately, I live in Switzerland. We have 4 different languages (DE, FR, IT and Romantsch), all use CHF. Worse, in Germany and Austria they speak also German and in France (among others) and Italy French and Italian but they use EURO or other currencies. As far as I know there is CH-DE and CH-FR language packs but no CH-IT or CH-"ROM". So its very complicated ;) To use the plugin I would have to install at least 6 additional language packs and I would miss the Italien and Romantsch speaking parts of Switzerland. And I would have to tell Joomla to consider the browser language and not the installed language. My browser language e.g. is English. Terribly complicated for such a strange multilaguage county like Switzerland ;)

An as far as I know there are a lot of different countries that speak e.g. English or French or Spanish or Portugese that have different currencies. Similar problem.

Its a nice plugin that works for a lot of countries but I think I stick to checking the visitors domain extension (.ch) to decide if I present CHF or EURO.

Or I have missed or misunderstood something essential about the plugin.

Thank you very much and kind regards

Alexander
Post Reply