Use of rounded ammounts to avoid problems with .and, (euro)

A place to discuss and receive support for the Web Auction application.

Use of rounded ammounts to avoid problems with .and, (euro)

Postby manskie » Mon Oct 06, 2008 6:19 am

I changed the used currency from dollar to euro but now I encounter problems with not-rounded bids.

If somebody wants to bid 5 euro and changes the default 5.00 to 5,00 (which is the proper annotation in the Netherlands) the bid is taken as 500 euro's instead of 5 euro's

Is there an easy way to avoid this, or to change the function of , to . ????
Maybe a check for a comma in the entered field and autochange it to dot.

<i>In my auction ist very unlikely to have bids above 1000 euro</i>
Posts: 6
Joined: Mon Sep 22, 2008 3:29 am

Postby shannah » Mon Oct 06, 2008 10:23 am

Ahh.. good question. I'm scouring the web to find the best practice for handling this. I'm sure it'll be a simple fix, but I want to do some research on it first.

Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Think I found it!

Postby manskie » Tue Oct 07, 2008 6:07 am

This is a very simple solution that seems 2 work 4 me (no guarantees):

In the autions\bid.php on line 10 ther is a preg_replace statement which I looked up at It filters out the unwanted chars and put them in a given format.

I changed this:

$amount = floatval(preg_replace('/[^\.0-9]/', '',$_POST['--bid-amount']));


$amount = floatval(preg_replace('/[^\.,0-9]/', '',$_POST['--bid-amount']));

So I added a comma there. If I enter 5,00 it is regarded as 5 euro ....
Posts: 6
Joined: Mon Sep 22, 2008 3:29 am

Postby Karonthe » Mon Nov 10, 2008 12:49 am

There is still another place where currencies are shown up, actions/watch_list.php, as a result of this part of a sql query:

select p.product_id, p.product_name, concat('\$',format(high_bid,2)) as high_bid, high_bidder from products p...

I've changed it to show the euro symbol:

select p.product_id, p.product_name, concat(format(high_bid,2),' \€') as high_bid, high_bidder from products p

... but don't know how to make it show the decimal point and thousands in an easy way. Any idea?
Posts: 9
Joined: Tue Oct 21, 2008 6:03 am

Return to Web Auction Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved