Number of bids incorrect?

Discussion in 'General Support' started by pani100, Oct 23, 2012.

Thread Status:
Not open for further replies.
  1. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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);
    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?
     
  2. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    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.
     
  3. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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.
     
  4. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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.
     
    Last edited: Oct 24, 2012
  5. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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;
    needs to be
    PHP:
    $query "UPDATE " $DBPrefix "auctions SET current_bid = " floatval($cbid) . ", num_bids = num_bids + 2 WHERE id = " $id;
    and line 381
    PHP:
    $query "UPDATE " $DBPrefix "auctions SET current_bid = " floatval($cbid) . ", num_bids = num_bids + 1 WHERE id = " $id;
    needs to be
    PHP:
    $query "UPDATE " $DBPrefix "auctions SET current_bid = " floatval($cbid) . ", num_bids = num_bids + 2 WHERE id = " $id;
    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.
     
  6. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    I will also test it and let you know Pani!
     
  7. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,565
    Likes Received:
    544
    @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 ;)
     
    Last edited: Oct 24, 2012
  8. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Just seen this Nay27uk, thank you. Just trying to contribute as much as I can just like you do every day now.
     
  9. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    It is Ok now Pani, thank you!!!!!:D
     
  10. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    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
     
  11. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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.
     
  12. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    How can I fix it?
     
  13. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Are you on balance or live payments mode?
     
  14. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    balance payments mode!
     
  15. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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.
     
  16. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    How can I added Pani? or and thank you for looking in to it.
     
  17. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    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($res0);
    if (
    $system->SETTINGS['fee_type'] == || $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'] == || $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__);
     
    Last edited by a moderator: Oct 29, 2012
  18. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    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']);
    }
    }
    }
    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']);
        }
    }
    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'])
    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.
     
  19. softsa

    softsa New Member

    Joined:
    Aug 2, 2011
    Messages:
    182
    Likes Received:
    2
    Thanks Pani, I have tried but nothing happens i get an error all the time it is to difficult for me.
     
Thread Status:
Not open for further replies.

Share This Page