Page 1 of 3

help need to change currency

Posted: Mon Nov 02, 2009 7:54 am
by volkswest
hello, I have a website http://www.volkswestads.co.uk but I need to change the currency from $ to £, also on my prices page the currency is in $ and again needs to be £, I have been told that this needs to be changed in mysql, but I know little about PHP, if any one can help or do the job for me I will be willing to pay to put this right, thanks everyone.
Shane

Re: help need to change currency

Posted: Mon Nov 02, 2009 9:53 am
by Eric!
Depends on how is it stored in your database and how it is displayed on your site. Is the sql field DECIMAL, VARCHAR or INTEGER?

Do you want to use dollars anywhere or do you want everything in pounds all the time?

Re: help need to change currency

Posted: Mon Nov 02, 2009 10:24 am
by volkswest
Thanks for the reply, like I said in my previous reply I know little about PHP, so I cant answer the following sql field DECIMAL, VARCHAR or INTEGER? Yes I want it just in £ currency, Thanks

Re: help need to change currency

Posted: Mon Nov 02, 2009 10:46 am
by pickle
Are you actually converting the values (as in, something that sells for $1.00 will now be £0.61), or are you just changing the character that goes in front of the numbers?

Re: help need to change currency

Posted: Mon Nov 02, 2009 10:52 am
by volkswest
So excuse my ignorance, but how do I change this please??

Re: help need to change currency

Posted: Mon Nov 02, 2009 11:12 am
by pickle
Please read my post and answer my question.

Re: help need to change currency

Posted: Mon Nov 02, 2009 11:46 am
by volkswest
Sorry about that, I want to be actually converting the values from $ to £ because all payments go through paypal, and the character that goes in front of the numbers aswell from $ to£, thanks

Re: help need to change currency

Posted: Mon Nov 02, 2009 12:06 pm
by pickle
First off, I'd strip out the currency character - it shouldn't be in that database field anyway. You *might* be able to do that all in MySQL by doing something like this:

Code: Select all

UPDATE
  `theTable`
SET
  `theCurrencyField` = CAST(`theCurrencyField` AS UNSIGNED)
Then, in another query (though perhaps you could do it all in one query) do some math to convert from U.S. dollars (or any other dollar you've got) to the pound

Code: Select all

UPDATE
  `theTable`
SET
  `theCurrencyField` = `theCurrencyField` * 0.61
* 0.61 is the exchange rate Google reports

Re: help need to change currency

Posted: Mon Nov 02, 2009 12:11 pm
by volkswest
Hi Pickle, Can you do the job for me if I pay you???

Re: help need to change currency

Posted: Mon Nov 02, 2009 12:19 pm
by pickle
No. I've given you the information you need to do it yourself. Heck, you can probably just change the field and table names in those queries & it should work.

Re: help need to change currency

Posted: Mon Nov 02, 2009 12:23 pm
by Eric!
It might be a bit more complicated because the currency denomination being passed to Paypal needs to be set to pounds too. Also there could be code in the site that is doing some conversions between currencies too.

I doubt the currency symbol is in the database, though. It's probably just all numbers as a DECIMAL field, at least if it was done by someone who knows what they are doing.

@volkswest who did this code for you? Why can't you pay them to fix it?

Re: help need to change currency

Posted: Mon Nov 02, 2009 12:28 pm
by volkswest
Eric,
I bought this from a bloke in the USA, I have emailed him maybe 10 times to ask him about the currency, and the only answer I got is "you will have to change it in the mysql" apart from that he doesnt want to know. All I see in prices.php is $$a1[price]</td>\n</tr>\n"; which I changed to £$a1[price]</td>\n</tr>\n"; and this changed the $ sign on the prices page to the £ symbol, all I need now is to figure out how to change the $ to £ when people check out with paypal.

Re: help need to change currency

Posted: Mon Nov 02, 2009 9:57 pm
by Eric!
All you have to do is configure paypal to use pounds as your primary currency. I would guess your database is denomination independent and just stores a decimal number.

https://www.paypal.com/cgi-bin/webscr?c ... ro-outside

Re: help need to change currency

Posted: Tue Nov 03, 2009 4:07 am
by volkswest
This is the code I have in the payment page, my primary currency is £
I have tried to change the paypal code but nothing works.

Code: Select all

<?
require_once("conn.php");
require_once("includes.php");
 
if(empty($_GET[SelectedPackage]))
{
    header("location:$_SERVER[HTTP_REFERER]?e=1&PaymentGateway=$_GET[PaymentGateway]");
    exit();
}
elseif(empty($_GET[PaymentGateway]))
{
    header("location:$_SERVER[HTTP_REFERER]?e=2&SelectedPackage=$_GET[SelectedPackage]");
    exit();
}
else
{
    if(!empty($_SESSION[AgentID]))
    {
        $MyID = $_SESSION[AgentID];
    }
 
    if(!empty($_SESSION[MemberID]))
    {
        $MyID = $_SESSION[MemberID];
    }
 
    //get the agent details
    $q1 = "select * from class_members where MemberID = '$MyID' ";
    $r1 = mysql_query($q1) or die(mysql_error());
    $a1 = mysql_fetch_array($r1);
 
    //get the price details
    $q2 = "select * from class_prices where PriceID = '$_GET[SelectedPackage]' ";
    $r2 = mysql_query($q2) or die(mysql_error());
    $a2 = mysql_fetch_array($r2);
 
    /*
 
    flags:
 
    r -> renew
 
    n -> new
 
    m -> more
 
    */
 
    if(ereg("renew.php", $_SERVER[HTTP_REFERER]))
    {
        $flag = "r";
        $action = "Renewal";
    }
    elseif(ereg("more.php", $_SERVER[HTTP_REFERER]))
    {
        $flag = "m";
        $action = "Upgrade";
    }
    else
    {
        $flag = "n";
        $action = "Activation";
    }
 
    if($_GET[PaymentGateway] == "paypal")
    {
        header("location:https://www.paypal.com/xclick?business=$aset[PayPalEmail]&item_name=$a2[ads] ads for $a2[days] days&first_name=$a1[FirstName]&last_name=$a1[LastName]&email=$a1[email]&item_number=1&custom=$MyID|$_GET[SelectedPackage]|$flag&amount=$a2[price]&notify_url=http://$_SERVER[HTTP_HOST]".dirname($_SERVER[PHP_SELF])."/notify.php&return=http://$_SERVER[HTTP_HOST]".dirname($_SERVER[PHP_SELF])."/login.php");
 
        exit();
 
    }
    elseif($_GET[PaymentGateway] == "stormpay")
    {
        header("location:https://www.stormpay.com/stormpay/handle_gen.php?generic=1&vendor_email=$aset[sp_vendor_email]&payee_email=$aset[sp_payee_email]&transaction_ref=$MyID|$_GET[SelectedPackage]|$flag&product_name=$a2[ads] ads for $a2[days] days&amount=$a2[price]&require_IPN=1&notify_URL=http://$_SERVER[HTTP_HOST]/sp_notify.php&return_URL=http://$_SERVER[HTTP_HOST]".dirname($_SERVER[PHP_SELF])."/login.php&cancel_URL=http://$_SERVER[HTTP_HOST]".dirname($_SERVER[PHP_SELF])."/cancel.php");
      
        exit();
    }
}
 
?>

Re: help need to change currency

Posted: Tue Nov 03, 2009 6:25 am
by Eric!
Please only post code using the proper tags. You can go back and edit your posts,
[syntax=php]Paste Code Here[/syntax]

Who integrated your site with paypal? Do the payments go to your own paypal account? Did the code also configure mysql for you too?