vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Help me finish: Discount for paid subscriptions (https://vborg.vbsupport.ru/showthread.php?t=81967)

luroca 05-24-2005 04:04 PM

Help me finish: Discount for paid subscriptions
 
1 Attachment(s)
Please, excuse my bad English.

This hack allows to assign to paid subscriptions a discount for selected usergroups. It is a very requested hack and I was tired to wait that somebody writes it. The problem is that I don?t know to code :)

It has two ?minor? bugs and a very important bug:
Minor bugs:

1) The discount is the same for all currencies (dollars, pounds, euros). It?s only a problem if you have prices in more than one currency.
2) The format of the cost changes from (for example) $5.00 to $5 (without the .00) if discount is applied. It is an aesthetic bug.

The very important bug:

3) The transaction with paypal goes OK, the user pays his subscription (with discount), he receives his receipt, he returns to the forum but no subscription it is applied to the user or writen in the database. As the doctors say: the surgery has been a success but the patient has died.

Is this forum the correct place and somebody can help me with this hack?

Thanks in advance

amykhar 05-24-2005 04:45 PM

First very important question. Do your non-discounted subscriptions work?

luroca 05-24-2005 05:51 PM

Very good question, I see :)

If discount = 0, OK
If discount = "", OK
If discount exists and user is not in usergroups with discount, OK

if discount exist and user has discount, FAIL

Thanks for your interest.

amykhar 05-24-2005 06:06 PM

Next question. Look at the code where payments are accepted. In the area where it verifies the transaction and makes the usergroup switch, etc. does it check to see if the received payment equals the subscription amount that you established?

It looks like it does on this line in paypal.php

Code:

$cost = unserialize($sub['cost']);
If so, that's your problem. You are going to have to account for the discount.

luroca 05-24-2005 06:19 PM

I have edited 3 files:

/includes/function_subscriptions.php
/admincp/subscriptions.php
/forum/subscriptions.php

but not paypal.php file. Must I edit it? Please, which values/variables are compared?

amykhar 05-24-2005 06:38 PM

I showed you the line. And, the file you edit depends on the type of subscription service you are using.

If you are using paypal, change that line so that the cost is equal to the base cost or the discounted cost. Then, it will pass that cost off to the build_subscriptions function and you should be good to go.

luroca 05-24-2005 06:45 PM

Thank you very much, as coder I am a pity but I´ll try.
Thanks again.


All times are GMT. The time now is 11:39 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.01084 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete