Jump to content

conversion rate and showing it on cart


hozzt

Recommended Posts

hi,

 

we are in turkey and we sell our products in US dollars. but our costumers want to see the exact turkish lira rate and they want to know how much turkish money they are going to pay.

 

we want to show both $ and TL and/or the conversion rate of the exact time.

 

is it possible?

 

 

thank you.

Link to comment
Share on other sites

The following script gets the current USD and TRY conversion rate from the European Central Bank website.

{php}
$XMLContent = file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
$amount	 = 1.00;

foreach($XMLContent as $line)
{
if(ereg("currency='USD'", $line, $currencyCode)) ereg("rate='([[:graph:]]+)'", $line, $usd);
if(ereg("currency='TRY'", $line, $currencyCode)) ereg("rate='([[:graph:]]+)'", $line, $try);
}

echo $amount." USD = ".round($amount / $usd[1] * $try[1], 2)." TRY";
{/php}

The feed is updates once a day. Recommended is to cache the values so it doesn't load every time someone loads the cart.

 

Based on this you can try to modify it so it will convert the cart total.

Edited by m00
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated