User Profle - My Bids

Details of modifications which users can incorporate within Enuuk Auction Platform free of charge
Post Reply
RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

User Profle - My Bids

Post by RWAP » Mon Sep 05, 2011 8:41 am

A user has suggested that the section in the user profile (My Bids) should only list actual bids on auctions - at the moment, it includes purchases under buy it now, fixed price and lot auctions too.

I would therefore suggest the following:

In class\User.php

find:

Code: Select all

    public function getBidsStatsFromDB(MyPDO $DB)
    {
        $stats = array();
        $stats['bids'] = count(Bid::getListFromDB($DB,' where bids.userId="'.$this->id.'"')); //SPEEDUP
        return $stats;
    }
Change this to (the less intensive):

Code: Select all

    public function getBidsStatsFromDB(MyPDO $DB)
    {
        $stats = array();
        $sql = 'select count(*) as cnt
                            from '.Bid::DB_TABLE.' bids
                            left join '.Offer::DB_TABLE.' as offers on offers.id=bids.offerId
                            ';
        $query = $DB->query($sql.' where bids.userId="'.$this->id.'" and offers.active=1 and (offers.type="'.Offer::STANDARD.'" OR offers.type="'.Offer::REVERSE.'" OR offers.type="'.Offer::PENNY.'")');
        $bids = $query->fetch(PDO::FETCH_ASSOC);
        unset($query);
        $stats['bids'] = intval($bids['cnt']);
        return $stats;
    }
Then, in class\Action\User.php
Find:

Code: Select all

        $data['user'] = $user->getPublicData();
        $data['bids'] = Bid::getListFromDB($this->db,'where bids.userId="'.$id.'" order by bids.date desc');
Change this to:

Code: Select all

        $data['user'] = $user->getPublicData();
        $data['bids'] = Bid::getListFromDB($this->db,'where bids.userId="'.$id.'" and offers.active=1 and (offers.type="'.Offer::STANDARD.'" OR offers.type="'.Offer::REVERSE.'" OR offers.type="'.Offer::PENNY.'") order by bids.date desc');

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests