Guest Posted November 3, 2008 Posted November 3, 2008 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. <?php 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. Quote
Guest Posted November 3, 2008 Posted November 3, 2008 Only use number format on the output not the input. Thanks Burt. Thought it was my in experience. Regards. Shane. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.