Automatic earnings converters

From CashCrusaderWiki

(Difference between revisions)
Jump to: navigation, search
(Earnings converters)
Current revision (09:31, 4 May 2010) (edit) (undo)
m (quote fixes)
 
Line 23: Line 23:
PHP Code, copy and paste following:
PHP Code, copy and paste following:
-
 
+
<code>
// --- START OF CODE ---
// --- START OF CODE ---
//-------------------------------
//-------------------------------
Line 33: Line 33:
// DO NOT EDIT BELOW
// DO NOT EDIT BELOW
//-------------------------------
//-------------------------------
-
$amount = number_format($cash_credited * 100000 * admin_cash_factor,0,'',''); // Circumvent PHP5 bug http://bugs.php.net/bug.php?id=43053
+
$amount = number_format($cash_credited * 100000 * admin_cash_factor,0,"",""); // Circumvent PHP5 bug http://bugs.php.net/bug.php?id=43053
@mysql_query("
@mysql_query("
INSERT INTO `".mysql_prefix."accounting`
INSERT INTO `".mysql_prefix."accounting`
Line 44: Line 44:
description='$points_debited converted to \$$cash_credited'");
description='$points_debited converted to \$$cash_credited'");
// --- END OF CODE ---
// --- END OF CODE ---
-
 
+
</code>
4. Press '''Save redemption'''
4. Press '''Save redemption'''
Line 82: Line 82:
// DO NOT EDIT BELOW
// DO NOT EDIT BELOW
//-------------------------------
//-------------------------------
-
$amount = number_format($points_credited * 100000,0,'',''); // Circumvent PHP5 bug http://bugs.php.net/bug.php?id=43053
+
$amount = number_format($points_credited * 100000,0,"",""); // Circumvent PHP5 bug http://bugs.php.net/bug.php?id=43053
@mysql_query("
@mysql_query("
INSERT INTO `".mysql_prefix."accounting`
INSERT INTO `".mysql_prefix."accounting`

Current revision

Couple small code snippets and guide for automated points to cash and cash to points converters.

Points to Cash converter

An example for creating 100 points to $0.01 automatic converter to redemption page. You can edit figures to make converter(s) for any amounts.


1. Login to your CashCrusader admin panel
2. Go to Accounting -> Redemption Options
3. Enter following details

   Sort Group: [any or according to your site]
   Qualifying Membership Type: All
   Description: 100 points to $0.01
   Type: Points
   Amount: 100
   Change this account type to: Do not
   Upgrade expires in: Never
   Automaticly deduct... : Yes

Special HTML, leave empty

PHP Code, copy and paste following:

   // --- START OF CODE ---
   //-------------------------------
   // Edit conversion details below
   //-------------------------------
   $points_debited = 100;
   $cash_credited = 0.01; // dollars
   //-------------------------------
   // DO NOT EDIT BELOW
   //-------------------------------
   $amount = number_format($cash_credited * 100000 * admin_cash_factor,0,"",""); // Circumvent PHP5 bug http://bugs.php.net/bug.php?id=43053
   @mysql_query("
       INSERT INTO `".mysql_prefix."accounting` 
       SET 
           unixtime='". unixtime ."', 
           transid='". maketransid($_SESSION['username']) ."', 
           amount='$amount',
           username='". $_SESSION['username'] ."', 
           type='cash', 
           description='$points_debited converted to \$$cash_credited'");
   // --- END OF CODE ---

4. Press Save redemption


Cash to Points converter

An example for creating $0.01 to 100 points automatic converter to redemption page. You can edit figures to make converter(s) for any amounts.


1. Login to your CashCrusader admin panel
2. Go to Accounting -> Redemption Options
3. Enter following details

   Sort Group: [any or according to your site]
   Qualifying Membership Type: All
   Description: $0.01 to 100 points 
   Type: Cash
   Amount: 0.01
   Change this account type to: Do not
   Upgrade expires in: Never
   Automaticly deduct... : Yes

Special HTML, leave empty

PHP Code, copy and paste following:

   // --- START OF CODE ---
   //-------------------------------
   // Edit conversion details below
   //-------------------------------
   $points_credited = 100;
   $cash_debited = 0.01; // dollars
   //-------------------------------
   // DO NOT EDIT BELOW
   //-------------------------------
   $amount = number_format($points_credited * 100000,0,"",""); // Circumvent PHP5 bug http://bugs.php.net/bug.php?id=43053
   @mysql_query("
       INSERT INTO `".mysql_prefix."accounting` 
       SET 
           unixtime='". unixtime ."', 
           transid='". maketransid($_SESSION['username']) ."', 
           amount='$amount',
           username='". $_SESSION['username'] ."', 
           type='points', 
           description='\$$cash_debited converted to $points_credited points'");
   // --- END OF CODE --- 

4. Press Save redemption

Personal tools
Administration manual