Jump to content



Photo
- - - - -

Auto Update Currencies


  • Please log in to reply
78 replies to this topic

#61   smalto

smalto
  • Members
  • 20 posts
  • Real Name:jp
  • Location:Switzerland, Grandvaux

Posted 08 June 2012 - 06:28

No it says that
unable to connect to www.oanda.com:5011 (Connection refused)
any clue to what has changed or what should be given as new path because it seems that it cannot connect to www.oanda.com:5011

Thank you for your help.

smalto
oscommerce 2.2 ms1 with contrib - lilibikini.com - 2005

#62   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 08 June 2012 - 12:50

I just tried updating manually in my site and got this result:

The exchange rate for US Dollar (USD) was updated successfully via oanda.
The exchange rate for Pounds (GBP) was updated successfully via oanda.

Notihng has changed in that part of my shop for years so it seems oanda is working fine.

#63   Marvin Miller

Marvin Miller
  • Members
  • 247 posts
  • Real Name:Marvin Miller
  • Gender:Male

Posted 01 December 2013 - 03:49

hi Jack!

I'd like to install this contrib (in fact, I think I may used it years ago on a MS 2.2 site) but today I'm using 2.3.3.4

First, thanks for making this contrib! A couple Q's;

1) will this mod work on 2.3.3.4 ?
2) Is there any way to make it so that it checks the currency during the checkout process? To me, running a task to update the currency, let's say, 4 times per day and each time a person checks out would make the most sense (given that my site is not that busy)

Thanks very much~!
Best & Thanks;
Marvin
----------------------
Installed Mods:
osCommerce 2.2 Milestone 2 + DropShadow
CanadaPost 3.6 Module w/Dimensions + UPS XML Module w/Dimensions & Time in Transit
Moneris Payment Module + X-Sell Module
Conditions Contrib + Canada Tax Zone Setup Notes
Fedex Real Time Quotes +...The New Separate Pricing Contribution !!!!

#64   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 01 December 2013 - 04:29

I haven't tried it on a 2.3.3.4 shop so I can't say. But it uses MySQL calls, versus the shops MySQL overlays, so my guess Is no. As far as updating on the shop side, that seems like it could cause a problem with the customer. Most exchanges don't change that often but if a customer had a large total for their cart and then went to checkout and an update occurred, they might think you are trying to pull something. It may also slow the site down since the code does have to wait for the other sites to respond.

#65   Marvin Miller

Marvin Miller
  • Members
  • 247 posts
  • Real Name:Marvin Miller
  • Gender:Male

Posted 01 December 2013 - 04:51

Good points all - thanks for the reply Jack. Perhaps one day you'll be able to take a look at 2.3.3.4 and and massage it /smile.png' class='bbc_emoticon' alt=':)' />
Best & Thanks;
Marvin
----------------------
Installed Mods:
osCommerce 2.2 Milestone 2 + DropShadow
CanadaPost 3.6 Module w/Dimensions + UPS XML Module w/Dimensions & Time in Transit
Moneris Payment Module + X-Sell Module
Conditions Contrib + Canada Tax Zone Setup Notes
Fedex Real Time Quotes +...The New Separate Pricing Contribution !!!!

#66   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 01 December 2013 - 13:41

It's on the todo list. /smile.png' class='bbc_emoticon' alt=':)' />

#67   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 14 June 2014 - 04:24

Hi Jack,

 

I just installed your addon - I have not set up a cronjob yet, but installed the code at the end of admin/index.php as instructed.

 

When I go into admin however I get this warning at the bottom of the page:

 

Fatal error: Cannot redeclare date_diff() in /home/creativ3/public_html/orders/admin/auto_update_currencies.php on line 44

 

And obviously, my currencies are not updated either.

 

Any ideas as to what is the problem?



#68 ONLINE   bonbec

bonbec
  • Members
  • 2 posts
  • Real Name:bon bec

Posted 14 June 2014 - 06:58

Hello bigbird_3156,

 

Take a look on the previous page, exactly the #57 message (thanks to kdenby) : http://forums.oscomm...-3#entry1636500



#69   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 14 June 2014 - 07:31

Hello bigbird_3156,

 

Take a look on the previous page, exactly the #57 message (thanks to kdenby) : http://forums.oscomm...-3#entry1636500

Thanks for that,

 

I did look through the old posts but was more concerned with finding the same error message as I got so missed it all together!



#70   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 14 June 2014 - 07:33

Sorry to post again so soon...

 

Do you know if there is an easy way to get the inverse values for the exchange rates?

 

I have a site set up with static prices for each foreign currency I use and I need this to convert them to AUD to charge the customer (yes they know that it happens this way).



#71   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 14 June 2014 - 13:12

I don't understand what it is you want to do but this addon just updates the exchange rate so that $1US = $1AUS. You could install the Second Currency addon, so that both AUS and some other currency can be displayed at the same time on the site.

#72   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 14 June 2014 - 14:15

Sorry, to explain a bit....

 

I am using AUD as my default currency, however I sell stock around the world at static prices in different currencies....

 

So something I sell in AUD for $8 I sell in USD for $6.60 and in GBP for $4.25 etc... these values stay the same ...

 

I have set this up with  the separate price per customer addon, and have modified my code so that the prices for the different currencies are not affected by the currency conversion ... however I now need to convert the static price (say USD$6.60 to AUD)...

 

to use this example if I have the default currency as AUD and convert the price using the current conversion rate 0.94030 I get a value of AUD $6.21 what I need to do is convert it using the inverse value (essentially converting Aussie dollars to US dollars) of 1.06394 to get a value of AUD $7.02

 

I need however to convert 4 different currencies to AUD for this all to work .. so I cannot set my default to USD (which would make the above example work)

 

Hopefully that makes sense????

- to clarify things a bit more ... if you look at this link on XE  http://www.xe.com/cu...o=USD&r=#rates
you will see that in the list they have 1AUD = USD 0.94030 and the inverse value of that is 1.06394.

 

I want the inverse value...



#73   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 14 June 2014 - 15:08

Thanks, I understand now. There's nothing written for that that I am aware of. You could try editing the admin/includes/functions/localization.php file and change
function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
to
function quote_xe_currency($from = DEFAULT_CURRENCY, $to) {
I haven't tried it but it would be my first guess. If it works, you would also have to change the function for oanda. If that doesn't work, then the code in the update section of currencies.php could be altered to figure out the exchange rate, once retrieved, and then alter the calculation so it uses the inverse. Good luck. :)

#74   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 15 June 2014 - 01:44

thanks for that Jack,

 

Gives me somewhere to start at least!

 

regards,

 

Peter



#75   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 16 June 2014 - 07:08

Is there any way to remove the HOURS_BETWEEN_UPDATES delay so that the Auto_update_currencies thing works instantaneously, I just want to get rid of it while I'm playing around with the code a bit so that I can test if it is working or not.



#76   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 16 June 2014 - 13:20

You can change that in the auto_update_currencies.php file, near the top. But you may want to just simulate a return instead of actually going to the site each time because if you visit it too much they may block your IP, at least for a while.


Edited by Jack_mcs, 16 June 2014 - 13:21.


#77   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 17 June 2014 - 08:43

Sick of me yet???? :blush:

 

I think I have my code sorted so it works for what I asked earlier (posts #72 & #73) once I'm sure I'll post it up here just incase there is another person who needs that info....

 

Quick question though... Do you know how often you can access the exchange rates without getting blocked out??? is every hour too frequent?



#78   Jack_mcs

Jack_mcs
  • Members
  • 26,467 posts
  • Real Name:Jack York
  • Gender:Male
  • Location:Michigan

Posted 17 June 2014 - 15:04

No, I don't. Those sites probably have a TOS page though.


Edited by Jack_mcs, 17 June 2014 - 15:05.


#79   bigbird_3156

bigbird_3156
  • Members
  • 143 posts
  • Real Name:Peter
  • Location:Australia

Posted 25 June 2014 - 08:11

Thanks, I understand now. There's nothing written for that that I am aware of. You could try editing the admin/includes/functions/localization.php file and change

function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
to
function quote_xe_currency($from = DEFAULT_CURRENCY, $to) {
I haven't tried it but it would be my first guess. If it works, you would also have to change the function for oanda. If that doesn't work, then the code in the update section of currencies.php could be altered to figure out the exchange rate, once retrieved, and then alter the calculation so it uses the inverse. Good luck. :)

 

in case anyone wants to get the inverse value, this is how you do it...

function quote_xe_currency($from, $to = DEFAULT_CURRENCY) {

and,

function quote_oanda_currency($base, $code = DEFAULT_CURRENCY) {