Stubbed
01-05-2010, 08:13 PM
This isn't exactly specific for VB4, but it is what I'll be using.
Has anyone or can anyone point me in the right direction for changing the hard coded currency for the subscription system? This only has to be PayPal if that makes life easier, and can replace one of the existing currencies.
Cheers;
--------------- Added 07 Jan 2010 at 10:42 ---------------
I got bored and figured this out.
Here are the instructions for adding a new currency to PayPal for anyone else's benefit:
First up, you need to find out the currency code for what you want to add. Generally you would already know this, but if you don't, go here: http://www.xe.com/ - I need New Zealand Dollars, so mine is NZD. Substitute NZD in the following code to what ever it is that you need.
open forumroot/admincp/subscriptions.php and make the following changes
Change line 214 from:
print_table_header($vbphrase['cost'], 10);to
print_table_header($vbphrase['cost'], 11);Just the 11 on the end
Under line 216, add the following:
$vbphrase['nz_dollars'],The whole lot should look like this:
print_cells_row(array(
$vbphrase['nz_dollars'],
$vbphrase['us_dollars'],The 'nz_dollars' bit is a phrase name. Change that to what ever you want, but remember it for later.
Under line 232, add the following:
$nzd = '<input type="text" class="bginput" name="sub[time][' . $i . '][cost][nzd]" dir="' . $direction . '" tabindex="1" size="7" value="' . number_format($sub_occurence['cost']['nzd'], 2, '.', '') . '" />';The whole lot should look like this:
foreach ($sub['cost'] AS $i => $sub_occurence)
{
$nzd = '<input type="text" class="bginput" name="sub[time][' . $i . '][cost][nzd]" dir="' . $direction . '" tabindex="1" size="7" value="' . number_format($sub_occurence['cost']['nzd'], 2, '.', '') . '" />';
$usd = '<input type="text" class="bginput" name="sub[time][' . $i . '][cost][usd]" dir="' . $direction . '" tabindex="1" size="7" value="' . number_format($sub_occurence['cost']['usd'], 2, '.', '') . '" />';Again, substituting nzd for what ever you're using.
Change line 247 from:
print_cells_row(array($usd, $gbp, $eur, $aud, $cad, $length, $recurring, $ccbill, $twocheckout, $options));to
print_cells_row(array($nzd, $usd, $gbp, $eur, $aud, $cad, $length, $recurring, $ccbill, $twocheckout, $options));
Change line 250 from:
print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 10);to
print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 11);Just the 11 on the end
Under line 1354, add the following:
'nzd' => $vbphrase['nz_dollars'],The whole lot should look like this:
print_select_row($vbphrase['currency'], 'currency', array(
'' => $vbphrase['all_currency'],
'nzd' => $vbphrase['nz_dollars'],
'usd' => $vbphrase['us_dollars'],
Under line 1415, add the following:
'nzd' => $vbphrase['nz_dollars'],The whole lot should look like this:
print_select_row($vbphrase['currency'], 'currency', array(
'' => $vbphrase['all_currency'],
'nzd' => $vbphrase['nz_dollars'],
'usd' => $vbphrase['us_dollars'],
open forumroot/includes/class_paid_subscription.php and make the following changes (Thanks to this post (https://vborg.vbsupport.ru/showpost.php?p=2134124&postcount=5))
Under line 182, add the following:
'nzd' => 'NZ$',The whole lot should look like this:
var $_CURRENCYSYMBOLS = array(
'nzd' => 'NZ$',
'usd' => 'US$',
The 'NZ$' bit is how you want your currency to be displayed.
We need to run an SQL query to update the PayPal Payment API. Do this in the VB Admin control panel or phpMyAdmin or what ever. Remember to put in your table prefix in front of `paymentapi` if you have one:
UPDATE `paymentapi` SET `currency` = 'nzd,usd,gbp,eur,aud,cad' WHERE `paymentapi`.`paymentapiid` =1 LIMIT 1 ;
Now you need to add a new phrase for your currency.
Login to your VB Admin CP > Languages & Phrases > Phrase Manager > Add New Phrase
'Varname' has to be what ever you put above. In my example I used "nz_dollars"
Put what ever you want in the 'Text' field. I put 'NZ Dollars'
Save You are done. You will now be able to make a new subscription using your custom currency following these instructions: http://www.vbulletin.com/docs/html/subscriptions_example
Win.
I've tested a few transactions now with no issues.
Has anyone or can anyone point me in the right direction for changing the hard coded currency for the subscription system? This only has to be PayPal if that makes life easier, and can replace one of the existing currencies.
Cheers;
--------------- Added 07 Jan 2010 at 10:42 ---------------
I got bored and figured this out.
Here are the instructions for adding a new currency to PayPal for anyone else's benefit:
First up, you need to find out the currency code for what you want to add. Generally you would already know this, but if you don't, go here: http://www.xe.com/ - I need New Zealand Dollars, so mine is NZD. Substitute NZD in the following code to what ever it is that you need.
open forumroot/admincp/subscriptions.php and make the following changes
Change line 214 from:
print_table_header($vbphrase['cost'], 10);to
print_table_header($vbphrase['cost'], 11);Just the 11 on the end
Under line 216, add the following:
$vbphrase['nz_dollars'],The whole lot should look like this:
print_cells_row(array(
$vbphrase['nz_dollars'],
$vbphrase['us_dollars'],The 'nz_dollars' bit is a phrase name. Change that to what ever you want, but remember it for later.
Under line 232, add the following:
$nzd = '<input type="text" class="bginput" name="sub[time][' . $i . '][cost][nzd]" dir="' . $direction . '" tabindex="1" size="7" value="' . number_format($sub_occurence['cost']['nzd'], 2, '.', '') . '" />';The whole lot should look like this:
foreach ($sub['cost'] AS $i => $sub_occurence)
{
$nzd = '<input type="text" class="bginput" name="sub[time][' . $i . '][cost][nzd]" dir="' . $direction . '" tabindex="1" size="7" value="' . number_format($sub_occurence['cost']['nzd'], 2, '.', '') . '" />';
$usd = '<input type="text" class="bginput" name="sub[time][' . $i . '][cost][usd]" dir="' . $direction . '" tabindex="1" size="7" value="' . number_format($sub_occurence['cost']['usd'], 2, '.', '') . '" />';Again, substituting nzd for what ever you're using.
Change line 247 from:
print_cells_row(array($usd, $gbp, $eur, $aud, $cad, $length, $recurring, $ccbill, $twocheckout, $options));to
print_cells_row(array($nzd, $usd, $gbp, $eur, $aud, $cad, $length, $recurring, $ccbill, $twocheckout, $options));
Change line 250 from:
print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 10);to
print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 11);Just the 11 on the end
Under line 1354, add the following:
'nzd' => $vbphrase['nz_dollars'],The whole lot should look like this:
print_select_row($vbphrase['currency'], 'currency', array(
'' => $vbphrase['all_currency'],
'nzd' => $vbphrase['nz_dollars'],
'usd' => $vbphrase['us_dollars'],
Under line 1415, add the following:
'nzd' => $vbphrase['nz_dollars'],The whole lot should look like this:
print_select_row($vbphrase['currency'], 'currency', array(
'' => $vbphrase['all_currency'],
'nzd' => $vbphrase['nz_dollars'],
'usd' => $vbphrase['us_dollars'],
open forumroot/includes/class_paid_subscription.php and make the following changes (Thanks to this post (https://vborg.vbsupport.ru/showpost.php?p=2134124&postcount=5))
Under line 182, add the following:
'nzd' => 'NZ$',The whole lot should look like this:
var $_CURRENCYSYMBOLS = array(
'nzd' => 'NZ$',
'usd' => 'US$',
The 'NZ$' bit is how you want your currency to be displayed.
We need to run an SQL query to update the PayPal Payment API. Do this in the VB Admin control panel or phpMyAdmin or what ever. Remember to put in your table prefix in front of `paymentapi` if you have one:
UPDATE `paymentapi` SET `currency` = 'nzd,usd,gbp,eur,aud,cad' WHERE `paymentapi`.`paymentapiid` =1 LIMIT 1 ;
Now you need to add a new phrase for your currency.
Login to your VB Admin CP > Languages & Phrases > Phrase Manager > Add New Phrase
'Varname' has to be what ever you put above. In my example I used "nz_dollars"
Put what ever you want in the 'Text' field. I put 'NZ Dollars'
Save You are done. You will now be able to make a new subscription using your custom currency following these instructions: http://www.vbulletin.com/docs/html/subscriptions_example
Win.
I've tested a few transactions now with no issues.