Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-05-2010, 08:13 PM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Subscription System: Change hard coded currency

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:
  1. 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.
  2. open forumroot/admincp/subscriptions.php and make the following changes
    1. Change line 214 from:
      Code:
          print_table_header($vbphrase['cost'], 10);
      to
      Code:
          print_table_header($vbphrase['cost'], 11);
      Just the 11 on the end
    2. Under line 216, add the following:
      Code:
              $vbphrase['nz_dollars'],
      The whole lot should look like this:
      Code:
          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.
    3. Under line 232, add the following:
      Code:
              $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:
      Code:
          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.
    4. Change line 247 from:
      Code:
              print_cells_row(array($usd, $gbp, $eur, $aud, $cad, $length, $recurring, $ccbill, $twocheckout, $options));
      to
      Code:
              print_cells_row(array($nzd, $usd, $gbp, $eur, $aud, $cad, $length, $recurring, $ccbill, $twocheckout, $options));
    5. Change line 250 from:
      Code:
          print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 10);
      to
      Code:
          print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 11);
      Just the 11 on the end
    6. Under line 1354, add the following:
      Code:
                  'nzd' => $vbphrase['nz_dollars'],
      The whole lot should look like this:
      Code:
              print_select_row($vbphrase['currency'], 'currency', array(
                  ''    => $vbphrase['all_currency'],
                  'nzd' => $vbphrase['nz_dollars'],
                  'usd' => $vbphrase['us_dollars'],
    7. Under line 1415, add the following:
      Code:
                  'nzd' => $vbphrase['nz_dollars'],
      The whole lot should look like this:
      Code:
                  print_select_row($vbphrase['currency'], 'currency', array(
                      ''    => $vbphrase['all_currency'],
                      'nzd' => $vbphrase['nz_dollars'],
                      'usd' => $vbphrase['us_dollars'],
  3. open forumroot/includes/class_paid_subscription.php and make the following changes (Thanks to this post)
    1. Under line 182, add the following:
      Code:
              'nzd' => 'NZ$',
      The whole lot should look like this:
      Code:
              var $_CURRENCYSYMBOLS = array(
                      'nzd' => 'NZ$',
                      'usd' => 'US$',
      The 'NZ$' bit is how you want your currency to be displayed.
  4. 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:
    Code:
    UPDATE `paymentapi`  SET  `currency`  =  'nzd,usd,gbp,eur,aud,cad' WHERE  `paymentapi`.`paymentapiid`  =1 LIMIT 1 ;
  5. Now you need to add a new phrase for your currency.
    1. Login to your VB Admin CP > Languages & Phrases > Phrase Manager > Add New Phrase
    2. 'Varname' has to be what ever you put above. In my example I used "nz_dollars"
    3. Put what ever you want in the 'Text' field. I put 'NZ Dollars'
    4. 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/s...ptions_example

Win.

I've tested a few transactions now with no issues.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04189 seconds
  • Memory Usage 2,602KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (17)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (12)post_thanks_box
  • (12)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (12)post_thanks_postbit_info
  • (12)postbit
  • (12)postbit_onlinestatus
  • (12)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete