WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000401WeBidBiddingpublic2012-10-23 09:152012-12-12 14:43
Reporterpani100 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version1.0.6 
Target VersionFixed in Version 
Summary0000401: Number of bids incorrect?
DescriptionHave just come across this and don't know if it is only my webid.

The number of bids nearly on all the site are taken from the auction table num_bids.

On the item page we get the number of bids from

[PHP]// history

$query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b

        LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)

        WHERE b.auction = " . $id . " ORDER BY b.bid DESC, b.quantity DESC, b.id DESC";

$result_numbids = mysql_query($query);

$system->check_mysql($result_numbids, $query, __LINE__, __FILE__);

$num_bids = mysql_num_rows($result_numbids);[/PHP]



I have had instances where it is 14 in auction table and nearly all the site (as we use 'BIDS' =>$row['num_bids'] but on item page the Bids# are 17 and match the item history of bids on the view history section.

This means nearly the whole site is reporting the wrong amount of bids apart from the item page?

Anyone experienced this?
TagsNo tags attached.
import_id402
Thread
Attached Files

- Relationships

-  Notes
(0001014)
pani100 (reporter)
2012-10-23 09:15
edited on: 1970-01-01 00:00

Have just come across this and don't know if it is only my webid.
The number of bids nearly on all the site are taken from the auction table num_bids.
On the item page we get the number of bids from
[PHP]// history
$query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b
        LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
        WHERE b.auction = " . $id . " ORDER BY b.bid DESC, b.quantity DESC, b.id DESC";
$result_numbids = mysql_query($query);
$system->check_mysql($result_numbids, $query, __LINE__, __FILE__);
$num_bids = mysql_num_rows($result_numbids);[/PHP]

I have had instances where it is 14 in auction table and nearly all the site (as we use 'BIDS' =>$row['num_bids'] but on item page the Bids# are 17 and match the item history of bids on the view history section.
This means nearly the whole site is reporting the wrong amount of bids apart from the item page?
Anyone experienced this?
(0001015)
softsa (viewer)
2012-10-23 10:50
edited on: 1970-01-01 00:00

Hi Pani, I have the same problem, I have 5 Bids, but it shows 7 bids, 2 more than the actual bids. I am using theme 123.
(0001016)
pani100 (reporter)
2012-10-23 11:02
edited on: 1970-01-01 00:00

Yes, if you view the bids in the item page you will find their are 7 bids made. So the actual rest of the site shows incorrect bids (or just the bids the users have placed without the proxy biddings maybe by webid?). Never ending problems.
(0001017)
pani100 (reporter)
2012-10-24 08:34
edited on: 1970-01-01 00:00

A bit more testing and yes num_bids in auctions table does not count all the bids.

So anywhere we use 'BIDS' =>$row['num_bids'] (which is all over the rest of the site apart from the item page will need to be replaced with the database query mentioned above. ). That's around 50 locations it will have to be changed.

The problem I think is when proxy bid bids for us it does not register it in the auctions table.
(0001018)
pani100 (reporter)
2012-10-24 09:44
edited on: 1970-01-01 00:00

I think I got it,
in bid.php
line 340 [PHP]$query = "UPDATE " . $DBPrefix . "auctions SET current_bid = " . floatval($cbid) . ", num_bids = num_bids + 1 WHERE id = " . $id;[/PHP]
needs to be
[PHP]$query = "UPDATE " . $DBPrefix . "auctions SET current_bid = " . floatval($cbid) . ", num_bids = num_bids + 2 WHERE id = " . $id;[/PHP]

and line 381
[PHP]$query = "UPDATE " . $DBPrefix . "auctions SET current_bid = " . floatval($cbid) . ", num_bids = num_bids + 1 WHERE id = " . $id;[/PHP]
needs to be
[PHP]$query = "UPDATE " . $DBPrefix . "auctions SET current_bid = " . floatval($cbid) . ", num_bids = num_bids + 2 WHERE id = " . $id;[/PHP]

As proxy bid only added 1 bid in auction table when it actually bids 2 times (one the new bidder and then a proxy bid.)

Looks like bid numbers are keeping all in line now. Will carry on testing. If anyone else wants to test it and report back then we can put it in the bugs if others are having the same problem.
(0001019)
softsa (viewer)
2012-10-24 12:17
edited on: 1970-01-01 00:00

I will also test it and let you know Pani!
(0001020)
nay27uk (reporter)
2012-10-24 13:36
edited on: 1970-01-01 00:00

@Pani100

On behalf of Renlok And all the members here at WeBid including myself and boxlot I would like to say a great big "THANK YOU" for your continued help and understanding as well as your appreciated input to the WeBid Project.

Members like you don't come around to often but when they do they quickly become an asset to the project, as you have done.

So Again THANKS on behalf of all the WeBid staff and members.

Keep up the great work and It's a pleasure to have you on board ;)
(0001021)
pani100 (reporter)
2012-10-26 05:13
edited on: 1970-01-01 00:00

nay27uk;29260 wrote

@Pani100

On behalf of Renlok And all the members here at WeBid including myself and boxlot I would like to say a great big "THANK YOU" for your continued help and understanding as well as your appreciated input to the WeBid Project.


Just seen this Nay27uk, thank you. Just trying to contribute as much as I can just like you do every day now.
(0001022)
softsa (viewer)
2012-10-26 08:34
edited on: 1970-01-01 00:00

It is Ok now Pani, thank you!!!!!:D
(0001023)
softsa (viewer)
2012-10-28 00:40
edited on: 1970-01-01 00:00

Hi Pani just seen that if a buyer fee is set at 2% the system is charging $2.00 instead of $40.00 on $2000.00 item? any clue?
Maybe Flat rate and % are mixed
(0001024)
pani100 (reporter)
2012-10-28 11:26
edited on: 1970-01-01 00:00

Yes I think it has a problem. I have seen a few threads with the same problem. It looks like there is a problem with the flat or % rate.
(0001025)
softsa (viewer)
2012-10-28 15:18
edited on: 1970-01-01 00:00

How can I fix it?
(0001026)
pani100 (reporter)
2012-10-28 17:15
edited on: 1970-01-01 00:00

Are you on balance or live payments mode?
(0001027)
softsa (viewer)
2012-10-28 18:24
edited on: 1970-01-01 00:00

balance payments mode!
(0001028)
pani100 (reporter)
2012-10-28 18:37
edited on: 1970-01-01 00:00

Looking at it deeper it doesn't matter as it only takes it as a normal value everywhere and not a percentage.
There is nowhere in the script to calculate it as %.
It will have to be added on. Don't know why it allows you to select flat fee or % in the admin if it doesn't do nothing with the drop down.
(0001029)
softsa (viewer)
2012-10-28 19:01
edited on: 1970-01-01 00:00

How can I added Pani? or and thank you for looking in to it.
(0001030)
softsa (viewer)
2012-10-29 16:08
edited on: 1970-01-01 00:00

Pani is this what you are referring to?

[PHP]// work out & add fee
if ($system->SETTINGS['fees'] == 'y')
{
$query = "SELECT value FROM " . $DBPrefix . "fees WHERE type = 'buyer_fee'";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$fee = mysql_result($res, 0);
if ($system->SETTINGS['fee_type'] == 1 || $fee <= 0)
{
$query = "UPDATE " . $DBPrefix . "users SET balance = balance - " . $fee . " WHERE id = " . $user->user_data['id'];
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
}
else
{
$bf_paid = 0;
$query = "UPDATE " . $DBPrefix . "users SET suspended = 6 WHERE id = " . $user->user_data['id'];
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
}
// do the final value fees
$query = "SELECT value, fee_type, fee_from, fee_to FROM " . $DBPrefix . "fees WHERE type = 'endauc_fee' ORDER BY value ASC";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$fee_value = 0;
while ($row = mysql_fetch_assoc($res))
{
if (floatval($Auction['buy_now']) > $row['fee_from'] && floatval($Auction['buy_now']) < $row['fee_to'])
{
if ($row['fee_type'] == 'flat')
{
$fee_value = $row['value'];
}
else
{
$fee_value = ($row['value'] / 100) * floatval($Auction['buy_now']);
}
}
}
if ($system->SETTINGS['fee_type'] == 1 || $fee_value <= 0)
{
$query = "UPDATE " . $DBPrefix . "users SET balance = balance - " . $fee_value . " WHERE id = " . $Auction['user'];
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
}
else
{
$query = "UPDATE " . $DBPrefix . "users SET suspended = 5 WHERE id = " . $Auction['user'];
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
$emailer = new email_class();
$emailer->assign_vars(array(
'ID' => $Auction['id'],
'TITLE' => $Auction['title'],
'NAME' => $Seller['name'],
'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=7&auction_id=' . $Auction['id']
&nbsp);
$emailer->email_uid = $Auction['user'];
$emailer->email_sender($Seller['email'], 'final_value_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['523']);
$ff_paid = 0;
}
}

$query = "INSERT INTO " . $DBPrefix . "winners VALUES
(NULL, " . $id . ", " . $Auction['user'] . ", " . $Winner['id'] . ", " . $Auction['buy_now'] . ", '" . $NOW . "', 0, 0, " . $qty . ", 0, " . $bf_paid . ", " . $ff_paid . ")";
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);[/PHP]
(0001031)
pani100 (reporter)
2012-10-29 18:34
edited on: 1970-01-01 00:00

yes this -> $fee = mysql_result($res, 0); That is wrong.
it should be just like 'endauc_fee' where we get all the data and check if it is flat or % like

[PHP]$fee_value = 0;
while ($row = mysql_fetch_assoc($res))
{
if (floatval($Auction['buy_now']) > $row['fee_from'] && floatval($Auction['buy_now']) < $row['fee_to'])
{
if ($row['fee_type'] == 'flat')
{
$fee_value = $row['value'];
}
else
{
$fee_value = ($row['value'] / 100) * floatval($Auction['buy_now']);
}
}
}[/PHP]
This is repeated in buy_now.php, cron.php and I think includes/functions.cron.inc.php and not checked for other locations it could be.
The problem is it runs in cron constantly. In cron we have

[PHP]// send buyer fee emails
if ($buyer_fee > 0)
{
    for ($i = 0; $i < count($buyer_emails); $i++)
    {
        $emailer = new email_class();
        $emailer->assign_vars(array(
                'ID' => $buyer_emails[$i]['id'],
                'TITLE' => $buyer_emails[$i]['title'],
                'NAME' => $buyer_emails[$i]['name'],
                'LINK' => $system->SETTINGS['siteurl'] . 'pay.php?a=6&auction_id=' . $Auction['id']
                ));
        $emailer->email_uid = $buyer_emails[$i]['uid'];
        $emailer->email_sender($buyer_emails[$i]['email'], 'buyer_fee.inc.php', $system->SETTINGS['sitename'] . ' - ' . $MSG['522']);
    }
}[/PHP]

As this is a constant value it obviously throws no error. If we put something like

[PHP]if ($Auction['current_bid'] > $buyer_fee[$i]['fee_from'] && $Auction['current_bid'] < $buyer_fee[$i]['fee_to'])[/PHP]
The $Auction['current_bid'] will not always be present to give us a true or false.
To change it we will need something to compare it with (as it could be % or cost based on final sale price) (£0-£9.99 = 5%), (£10.01 to £199.99 = 10%) etc..
It might work but will have to be done in all the places.
(0001032)
softsa (viewer)
2012-10-29 21:32
edited on: 1970-01-01 00:00

Thanks Pani, I have tried but nothing happens i get an error all the time it is to difficult for me.

- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 402
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2012-10-23 09:15
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2012-12-12 14:43


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker