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

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-23-2010, 12:08 AM
Fuhrmann Fuhrmann is offline
 
Join Date: May 2010
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice, nice! Thanks, this save my time.
Reply With Quote
  #3  
Old 12-15-2010, 03:04 AM
Assopoker Assopoker is offline
 
Join Date: Dec 2007
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are great
Its a shame that vbulletin can't set up currencies in a better way.
Reply With Quote
  #4  
Old 12-15-2010, 03:15 AM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good to see people are still using this. While it's annoying that it isn't a standard feature to customise currencies, this works 100% and it's not too hard to do the above mod manually.

I've put through ~500 transactions since, had no issues with it.
Reply With Quote
  #5  
Old 12-15-2010, 05:31 AM
Assopoker Assopoker is offline
 
Join Date: Dec 2007
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You missed something:
In /includes/class_paid_subscription.php
Add on line 183
Your :

'usd' => 'US$',

--------------- Added [DATE]1292398414[/DATE] at [TIME]1292398414[/TIME] ---------------

Can you tell me why

print_table_header($vbphrase['cost'], 11);
and
print_submit_row(iif($_REQUEST['do'] == 'add', $vbphrase['save'], $vbphrase['update']), '_default_', 11);
are needed?

did you tried without that change?
Reply With Quote
  #6  
Old 01-26-2012, 09:09 PM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wonder where the class_paid_subscription.php piece is displayed, mine has been working since 3.8 up to 4.1.4 with out it! Good to know though. Just followed the same changes for 4.1.10 and so far appears to be working. It's almost a good thing they haven't made any changes to the subscription system in the previous 4/5 years... Heh.

The numbers on the end change the number of columns on the table in the admincp. With out it you cut off the last currency which potentially isn't an issue for most people.
Reply With Quote
  #7  
Old 04-28-2012, 08:09 PM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No issues again on 4.1.12
Reply With Quote
  #8  
Old 01-19-2013, 05:36 AM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No issues again in 4.2. Won't be trying 5 for some time
Reply With Quote
  #9  
Old 05-02-2013, 09:14 PM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I've just installed a test vB5 install, and it appears that paid subscription currency is still hard coded, which is pretty disappointing.

I've created an improvement request in JIRA, if you use a currency outside of the standard, or if you think it's a bit silly this isn't in there by default, please head over and give it a vote: http://tracker.vbulletin.com/browse/VBV-9482
Reply With Quote
  #10  
Old 10-27-2013, 10:46 PM
Stubbed's Avatar
Stubbed Stubbed is offline
 
Join Date: Dec 2007
Location: New Zealand
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not surprisingly this same MOD worked on VB4.2.2.

Anyone still using this - Please vote for it to be included by default in VB5.
Reply With Quote
Reply


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 06:15 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.06644 seconds
  • Memory Usage 2,264KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (17)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (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_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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete