Welcome,

Guest

  • Member's Login
  • Member's Registration
  • Community
  • Download
  • Demo
  • Support
  • Store
Azer CMS > Community
Support > Tutorials > Multiple DP per USD/EUR/Etc...
Chris


Join Date: Sep 10, 2012
Location: Azer CMS
Posts: 637

DM: 🗨
Multiple DP per USD/EUR/Etc...
Posted 06-03-16, at 1:13 PM.

Please Register or Login to remove ads.

Please do not copy+paste. You will not learn anything from doing that. It is better to use what I am doing as an example and write it yourself, as this will properly teach you what it is used for and what it does.

This is actually very easy to do. I recommend using a variable for the modifier, placing the variable in config.php, so that way you will be able to find the variable fast and easily, without having to search the IPN Script to find it.

For this example, I want to change my system to give 10 Donator Points per USD. You can modify this number to be whatever you want, since it's your server.

Add to ./core/config/config.php:
//- Donator Point Multiplier/Modifier
$dp_mod = "10";


The first LOC (Line of Code) you added is a comment. This does not affect anything, and merely serves to provide information (it can also comment out a LOC to prevent it from being used, which is useful in many scenarios). The second is a variable. A variable is like a container, being that it holds data for you. When you use said variable, it will call upon the data you've stored in it.

Now, we need to edit the line that handles the new value for DP in the IPN Script. config.php is already included in the script (in basic terms, this means that the script already includes the contents of config.php in the script), so we don't need to write an include statement for our edit to the IPN Script when we open it.

Browse to ./core/inc/ipn/. Open the file called ipn.php, and browse to line 97. The variable on line 97 (shown in the quote below) will be what we are editing, since this variable holds the mathematics equation done to process the new DP. As you can see, it's just a simple addition problem, which will add the amount you paid ($payment_amount) to the amount of DP you had before ($old_dp).

Original Variable on L97:
$new_dp = $old_dp + $payment_amount;


For us to modify the amount of DP given per USD, we will need to multiply the value of $payment_amount. So now, we will change the equation to multiply the value of $payment_amount with the value of $dp_mod, and then add the value we get from that to the value of $old_dp.

New Variable on L97:
$new_dp = ($payment_amount * $dp_mod) + $old_dp;


And there we go. Ensure that you've saved all changes you've applied to config.php and ipn.php, so you won't lose them and potentially have unhappy Donators.

Please note: By modifying your instance of Azer CMS, you understand that you are not able to hold Azer CMS and/or its affiliates liable for any and all damage caused by your actions. You understand that you are, under your own volition, making these changes, and therefore are responsible for anything that occurs thereafter.
CreateNPlay
Join Date: Nov 26, 2017
Location:
Posts: 4

DM: 🗨
Multiple DP per USD/EUR/Etc...
Posted 11-28-17, at 4:42 AM.
Thanks for this, very well written.
Chris


Join Date: Sep 10, 2012
Location: Azer CMS
Posts: 637

DM: 🗨
Multiple DP per USD/EUR/Etc...
Posted 11-28-17, at 1:06 PM.
You're welcome, I'm glad to know that you found it useful. Let me know if there are other things you'd like to see a tutorial for.
<<
1

© Copyright 2023 Azer CMS.
All Rights Reserved.
Terms of Service.

DMCA.com Protection Status