Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

APR Calculator


Recommended Posts

Hi All


I'm quite green to PHP and to OScommerce so this could be my inexperience.


I'm in throws of creating an apr calculator for our website. I have a working version which will calculate an apr of 19.9% under £1000 and as we have to set a figure which this is not available at I have also set a minimum for this reason. But here the problem side.


Because of the legal side of advertising apr's you have to show all the information. Interest, Amount repayable and total amount repayable.


Now as i said the calculator works fine upto £1000. But I feel it's the format of £1,000.00 that is causing the problem and it may be may in experience showing.


Please have a look at my coding.


if ($product_info['products_price'] < 299.99){
echo '';
} else {
$calamount = ($product_info['products_price']);
$calapr = 0.03629639;
$calperiod = 36; 

$calmon = $calamount * $calapr;
$mon = number_format($calmon, 2, '.', ',');

echo '<br />Or £' . $mon . ' a month.';

$calcost = $calmon * $calperiod;
$number = number_format($calcost, 2, '.', ',');

echo '<br />Total Charge £' . $number . '.';

$calint = ($number - $product_info['products_price']);
$formatted2 = number_format($calint, 2, '.', ',');

echo '<br />Interest £' . $formatted2 . '.';


Looking on php.net it seems that it could be this but I'm green and would like a little more informationnumber_format


Now as I said the £1,000.00 is I feel causing the problem. anything upto £999.99 works fine so I feel comer is causing the problem. and if this is the reason has anybody seen how this has been resolved.


I look forward to anybodies comments.


Regards. Shane.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...