Page 1 of 2

Question regarding changing global currency default

Posted: 26 Dec 2022, 12:03
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

Re: Question regarding changing global currency default

Posted: 26 Dec 2022, 15:33
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

Re: Question regarding changing global currency default

Posted: 26 Dec 2022, 15:40
by Alexander
Hi Jan

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

Thank you very much!

Alexander

Re: Question regarding changing global currency default

Posted: 26 Dec 2022, 15:43
by Jan
Ok, great to hear it.

Re: Question regarding changing global currency default

Posted: 27 Dec 2022, 12:12
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

Re: Question regarding changing global currency default

Posted: 28 Dec 2022, 00:24
by Jan
Ok, thank you for the info.

Jan

Re: Question regarding changing global currency default

Posted: 06 Jun 2023, 14:56
by Jan

Re: Question regarding changing global currency default

Posted: 07 Jun 2023, 16:48
by Alexander
Hi Jan
Thank you!!! Nice that you remembered my question. I will test the plugin as soon as possible.
Kind regards
Alexander

Re: Question regarding changing global currency default

Posted: 07 Jun 2023, 22:04
by Jan
Ok

Re: Question regarding changing global currency default

Posted: 08 Jun 2023, 14:10
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