BitzBox_Matt Posted April 10, 2008 Posted April 10, 2008 Hi I am currently developing a website fro someone using OSCommerce 2.2 and I would like to know how to get the database to leave the shipping amount from the individual shipping contrib as two decimal palces without deleting zeros. For instance, £35.00 becomes £35 and £3.50 becoms £3.5 I notice that it lists the product price just fine, any one got any ideas? I would be very grateful for any respose. Matt
germ Posted April 10, 2008 Posted April 10, 2008 The database doesn't "drop zeros". You'll need to properly format the output where necessary. An example: <?php $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf("%01.2f", $money); // echo $formatted will output "123.10" ?> If you need specific code help, post again and I'll try. If it has to do with a contribution, please provide a link to it, and which version you are working with, so I can download it as well and you won't waste time posting code. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
BitzBox_Matt Posted April 11, 2008 Author Posted April 11, 2008 Ahhhh, I see. Thanks for the quick response, I'm not usually involved with the code so I just assumed that the database was stripping the zeros from the end because to the database I suppose they would be meaningless. I'll post here again in a few hours if I can't fix the problem using the method you showed me. Thanks for your help.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.