How do I Customize Points to display with a decimal?

Awarding points in fractions is generally not an intuitive practice and can lead to a lot of logical complexities. Because of this, MageRewards only allows points to be awarded or redeemed as whole numbers. However, we do understand that some reward campaigns require points to be displayed similarly to monetary currencies so it's better understood by the customers.

With MageRewards being a very customizable solution, this is possible. The main idea behind this is that points are still whole numbers in the system but when they are presented to customers on the front-end of the store, the display is customized to include decimal points. This means for example that 125 Points can be shown as 1.25 Points to customers. The article below explains how to do this by modifying some front-end template files.

How do I Customize Points to display with a decimal?

To convert  "You will earn 299 Points for buying this product" to "You will earn 2.99 Points for buying this product"

Follow the steps below:

1. Copy app/design/frontend/base/default/template/rewards/points.phtml to app/design/frontend/<your_package>/<your_theme>/template/rewards/points.phtml so that you are not modifying core template files.

2. Open app/design/frontend/<your_package>/<your_theme>/template/rewards/points.phtml, change line 45:

Find

$decimalPrecision = 0;
	


Replace with

$decimalPrecision = 2;
	


Find Line 56

$p = $points_array[0];
	


Replace with

$p = $points_array[0];<br>$p['amount']=$p['amount']/100;
	


To Display 0.1 as 0.10 Add below code on line 63

$p['amount_formatted']=number_format((float)$p['amount'], $decimalPrecision, $decimalPoint, $thousandSeparator);
	


3. Upload new and modified files to your server..

4. Clear your cache.

How do I Customize Points to display with a decimal in Slider?

1. Copy app/design/frontend/base/default/template/rewards/checkout/minicart_js to app/design/frontend/<your_package>/<your_theme>/template/rewards/checkout/minicart_js so that you are not modifying core template files.

2. Open app/design/frontend/<your_package>/<your_theme>/template/rewards/checkout/minicart_js, change line 49:

Find

var pts = val*this.points_per_use;
	


Replace with

var pts = val*this.points_per_use; val=val/100;
	


3. Upload new and modified files to your server..

4. Clear your cache.

How do I Customize Points to display in Points Summary Email.

Instead of copying the file to your theme, apply above changes directly in base file but NOTE if you plan to update MageRewards in the future in future, you need to apply these changes again.

 How do I customize the Send Points to a Friend in decimal format?

If you have followed the steps above to customize your points, you will also need to remember to update your Send Points to a friend email.

To do this, edit app\code\community\TBT\Rewards\controllers\Customer\SendpointsController.php 

and change
$points_amt = $this->getRequest ()->get ( 'points_amt' );
	
to
$points_amt = ($this->getRequest ()->get ( 'points_amt' ))*100;
	
NOTE if you plan to update MageRewards in the future in future, you need to apply these changes again.

Still need help? Get Help Get Help