WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000462WeBid[All Projects] Generalpublic2013-10-02 15:452015-04-01 17:20
ReporterDrJ 
Assigned To 
Priority@0@SeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version1.1.1 
Target VersionFixed in Version1.1.2 
Summary0000462: Reserve Not met Items Incorrectly Marked as Sold in Database
DescriptionScenario:

A user posts an item for sale in the auction. A reserve price of $100 is set for the item. During the course of the auction, User A places a bid of $5 for the item. The auction terminates with no other bids and the reserve not met.



Result:

The item is not sold since the reserve was not met. A check of the database reveals that the auction item is incorrectly marked as sold.



Can anyone shed some light on this issue?
TagsNo tags attached.
import_id464
Thread
Attached Filesjpg file icon reserve.jpg [^] (16,001 bytes) 2015-04-01 17:20


jpg file icon closed items webid.jpg [^] (21,055 bytes) 2015-04-01 17:20

- Relationships

-  Notes
(0001193)
DrJ (reporter)
2013-12-06 15:26
edited on: 1970-01-01 00:00

Bumping this thread since it has been two months without a response.
(0001194)
nay27uk (reporter)
2013-12-07 12:25
edited on: 1970-01-01 00:00

You say in the database it is listed as sold but is it in the CP?

 I.e if you log in as the seller and go to your CP does it show under sold items in the selling category?

Or does it show in the closed unsold with a relist option? from what I remember you will only see the relist this item link when an item is unsold.


if the latter is true then it cant be marked as sold in the DB so must be being stored somewhere else in another table
(0001195)
DrJ (reporter)
2013-12-07 15:45
edited on: 1970-01-01 00:00

nay27uk;36335 wrote

You say in the database it is listed as sold but is it in the CP?

 I.e if you log in as the seller and go to your CP does it show under sold items in the selling category?

Or does it show in the closed unsold with a relist option? from what I remember you will only see the relist this item link when an item is unsold.


if the latter is true then it cant be marked as sold in the DB so must be being stored somewhere else in another table


Good question. My testing skills are slipping.

The item does not show in either the Closed list or the Sold list in My Control Panel. As you stated, I think it would only show in the closed list if it wasn't sold and could be relisted. As for why it doesn't show in the Sold list of CP, I don't know.

[ATTACH=CONFIG]2074[/ATTACH]

Above is the line from the database where you can see the reserve price, one bid of 0.99 and the "y" in the sold column.


UPDATE: I believe the reason the item is not listed in the CP Sold list is because the code does not use the "sold" column from the "auctions" table and only lists the item as sold if there is an entry in the "winners" table.

See the following code from the yourauctions_sold.php file:
[PHP]$query = "SELECT a.* FROM " . $DBPrefix . "auctions a, " . $DBPrefix . "winners w
        WHERE a.user = " . $user->user_data['id'] . "
        AND a.closed = 1
        AND a.suspended = 0
        AND a.id = w.auction
        GROUP BY w.auction
        ORDER BY " . $_SESSION['solda_ord'] . " " . $_SESSION['solda_type'] . " LIMIT " . $OFFSET . "," . $system->SETTINGS['perpage'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

$i = 0;[/PHP]
(0001196)
nay27uk (reporter)
2013-12-08 00:56
edited on: 1970-01-01 00:00

ok so somewhere we need to find where it is pulling the information for the pages and add some code so that before the auction closes it checks to see if the current_bid row is lesser than the reserve_price row and if it is it should be marking it as N in the database, like it is in your second auction in the that picture.

Where it is marked as Y on your picture it seems it is not doing a

IF current_bid < reserve_price then mark as N

If you get what am trying to say

In other words it is not checking to see if the current bid is lower than the reserve price and as a result it is marking it as sold as in your picture
(0001197)
DrJ (reporter)
2013-12-08 01:05
edited on: 1970-01-01 00:00

I agree. The second line in the database image was also a test but in that test there was no bid, so it was not marked as sold. I don't know if this issue exists in previous versions. Perhaps the code is different in v1.0.6. Something I'll have to look into.
(0001198)
nay27uk (reporter)
2013-12-08 01:14
edited on: 1970-01-01 00:00

I am unsure about that but this is a problem and it looks like the second one is checking the current_bid row and because it is 0 it is being marked as N this should be the case for the other as well but the code should need to first check both the current_bid and reserve_price rows and check if the current_bid is lesser than the reserve_price and if yes mark it as N if it is not then mark it as Y.

 I am not the best coder on here and cant even type an example but I hope you get what I am saying
(0001199)
DrJ (reporter)
2013-12-08 01:23
edited on: 1970-01-01 00:00

nay27uk;36339 wrote

I am unsure about that but this is a problem and it looks like the second one is checking the current_bid row and because it is 0 it is being marked as N this should be the case for the other as well but the code should need to first check both the current_bid and reserve_price rows and check if the current_bid is lesser than the reserve_price and if yes mark it as N if it is not then mark it as Y.

 I am not the best coder on here and cant even type an example but I hope you get what I am saying


I completely understand. I am not a good coder either, I just try to understand what is wrong. I usually end up getting help from guys like pani100. Anyway, I'm going to test v1.0.6. If I get a different result, maybe we can pull from that code, if it is similar. If the result is the same, then this issue probably existed for quite a while. I will report my testing results.
(0001200)
nay27uk (reporter)
2013-12-08 01:25
edited on: 1970-01-01 00:00

Please do.

 I use 1.1.0 but have not got that far into testing yet as most of my testing so far has been step by step during my theme building, things like adding an item from the default theme to get it to display in my theme ect
(0001201)
DrJ (reporter)
2013-12-08 01:43
edited on: 1970-01-01 00:00

OK. I ran the same test using the same criteria on v1.0.6. The result is exactly the same. One small bid, reserve not met, shows as SOLD in the database. Does not appear on either the closed or sold items lists in CP. So 1.0.6 will be of no help. Next I'm going to look at the code which tests to see if the reserve is met on the item page. Maybe some code there that can be used or adjusted for our purpose.

UPDATE:
The only place in the entire script I can find an update to the database to change the sold column is in the cron.php file. the following code in from line 0000290:
[PHP]// Close auction
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
            }[/PHP]
(0001202)
pani100 (reporter)
2014-02-24 08:49
edited on: 1970-01-01 00:00

DrJ;36343 wrote

OK. I ran the same test using the same criteria on v1.0.6. The result is exactly the same. One small bid, reserve not met, shows as SOLD in the database. Does not appear on either the closed or sold items lists in CP. So 1.0.6 will be of no help. Next I'm going to look at the code which tests to see if the reserve is met on the item page. Maybe some code there that can be used or adjusted for our purpose.

UPDATE:
The only place in the entire script I can find an update to the database to change the sold column is in the cron.php file. the following code in from line 0000290:
[PHP]// Close auction
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
            }[/PHP]


Hi DrJ, just seen this and the other thread you have posted about this. I am running some tests with reserve items on my webid and will see what happens after 24h.
(0001203)
DrJ (reporter)
2014-02-24 14:47
edited on: 1970-01-01 00:00

Hi pani100, thanks for looking at this. I had forgotten about this issue until someone else brought it up. Your coding experience is needed for this one.
(0001204)
pani100 (reporter)
2014-02-25 08:49
edited on: 1970-01-01 00:00

DrJ;37408 wrote

Hi pani100, thanks for looking at this. I had forgotten about this issue until someone else brought it up. Your coding experience is needed for this one.

Just an update with my findings on this.
I set up 3 standard auctions with reserve. on one i made a lower than reserve bid, the other had it to relist and 3rd just let it roll out of time.

-In the admin side I can see all correct, the 2 that closed are in the listclosedauctions.php and the relisted one is in the listauctions.php.

-in the user CP I only see 2 auctions. The relisted and the closed (without any bids) -so the one with the lower bid is missing. I can't find this at all but should be able find it in the closed to relist it as it did not sell or delete it.

- in the closed_auctions.php for the user I can see all correct, 1 relisted in the open auctions and 2 closed auctions

- in the browse.php i can see again all auctions correctly,1 open and 2 closed.

Is this the same behaviour as you are having?

Looks like the query call in user CP (yourauctions_c.php) might need looking at as it possibly has a where clause preventing it from showing.
I will have a look at the query in a few minutes

Update
Its right there:
AND (num_bids = 0 OR (num_bids > 0 AND current_bid < reserve_price AND sold = 'n'))";

As you have mentioned a bid has been entered causing the sold to change to y even though its lower than the reserve. So we backtrack in to the bid.php and see why it changes it to sold even thought the reserve is higher.

Update2
The bid.php has no function to alter the sold column. Looks like we will be heading to the cron.php.
What I can make out the sold column changes state from the cron.php when the auction possibly ends. So we will need to add a reserve check in the cron.php when any auctions end. Would be an idea to find out why sold has got 3 states. Need to trace for any uses of the sold state in the complete script to see what the different states do.

Update3
After having a little play I am trying this query in cron.php for the closing of any auctions (around line 290).

[PHP]// Close auction
        if ($Auction['sold'] == 's') {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1 WHERE id = " . $Auction['id'];
        } elseif ($Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }[/PHP]

Top condition makes sure we can sell underprice if a lower than reserve bid has been made and move the auction to the sold CP page. The setting of the sold='s' was being overwritten by this query so underselling resulted in auction being in sold and closed.
Second should add sold= 'n' if reserve not met , to allow the auction view in CP closed page with an option to sell underprice.
Third is all the rest.
If you want to test this too, I will see if it works as it should tomorrow
(0001205)
DrJ (reporter)
2014-02-25 15:44
edited on: 1970-01-01 00:00

pani100;37424 wrote

Just an update with my findings on this.
I set up 3 standard auctions with reserve. on one i made a lower than reserve bid, the other had it to relist and 3rd just let it roll out of time.

-In the admin side I can see all correct, the 2 that closed are in the listclosedauctions.php and the relisted one is in the listauctions.php.

-in the user CP I only see 2 auctions. The relisted and the closed (without any bids) -so the one with the lower bid is missing. I can't find this at all but should be able find it in the closed to relist it as it did not sell or delete it.

- in the closed_auctions.php for the user I can see all correct, 1 relisted in the open auctions and 2 closed auctions

- in the browse.php i can see again all auctions correctly,1 open and 2 closed.

Is this the same behaviour as you are having?

Looks like the query call in user CP (yourauctions_c.php) might need looking at as it possibly has a where clause preventing it from showing.
I will have a look at the query in a few minutes

Update
Its right there:
AND (num_bids = 0 OR (num_bids > 0 AND current_bid < reserve_price AND sold = 'n'))";

As you have mentioned a bid has been entered causing the sold to change to y even though its lower than the reserve. So we backtrack in to the bid.php and see why it changes it to sold even thought the reserve is higher.

Update2
The bid.php has no function to alter the sold column. Looks like we will be heading to the cron.php.
What I can make out the sold column changes state from the cron.php when the auction possibly ends. So we will need to add a reserve check in the cron.php when any auctions end. Would be an idea to find out why sold has got 3 states. Need to trace for any uses of the sold state in the complete script to see what the different states do.

Update3
After having a little play I am trying this query in cron.php for the closing of any auctions (around line 290).

[PHP]// Close auction
        if ($Auction['sold'] == 's') {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1 WHERE id = " . $Auction['id'];
        } elseif ($Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }[/PHP]

Top condition makes sure we can sell underprice if a lower than reserve bid has been made and move the auction to the sold CP page. The setting of the sold='s' was being overwritten by this query so underselling resulted in auction being in sold and closed.
Second should add sold= 'n' if reserve not met , to allow the auction view in CP closed page with an option to sell underprice.
Third is all the rest.
If you want to test this too, I will see if it works as it should tomorrow


Hi pani100, thanks for having a look at this. My suspicions were correct as to where the problem seems to initiate. That line in the cron.php is the ONLY code in the entire program which marks an item "sold=y". I just don't have the coding expertise to fix it. I will test your fix at my earliest convenience and report back. Thanks again.
(0001206)
david62311 (reporter)
2014-02-26 05:19
edited on: 1970-01-01 00:00

Hello pani100 & DrJ and webid fans. Sorry to intrude here. DrJ you are so close and I think you answered it somewhere yesterday trying to use the 's' instead of the 'y' You should see the database display an 's' now correctly using the code below on line 290 to 292 of the cron.php and when the item is sold and you should also see an 'n' when the item isn't sold.:

[SIZE=5]DON'T DO THIS! I GOT BURNED BY PLAYING WITH THIS FIRE!!![/SIZE]
Someone wrote

// Close auction
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 's' WHERE id = " . $Auction['id'];
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);


The 'y' was not coming up with the code change that I tried. It was showing an 'n' when I used the 'sell under'. The 's' seems to work.

When someone told me this issue was very old, I didn't know how old. It seems like Box Lot had the answer a while back. I actually found this link with Google. I had to look outside the box to see the Box Lot. http://www.webidsupport.com/forums/showthread.php?3827-get-last-closed-auctions-NOT-sold" [^" title="]]http://www.webidsupport.com/forums/showthread.php?3827-get-last-closed-auctions-NOT-sold[/URL] [^]

This code solved another issue I was having with the 'sell under' price checkbox code I've been working on trying to fix. The 'sell under' really should be worded 'sell to highest bidder' or longer 'sell under reserve price' to highest bidder. I have all my checkboxes working on the Closed Auctions page. I coded the javascript codes for the checkboxes last week but, was missing the correct code on the yourauctions_c.php side.

After I came up with my code fix yesterday, I was able to check the 'sell under' and processing the item that I had checked, it was sending an email to the highest bidder telling them they won. The item was showing up in the yourauctions_sold page and winner details. The bug in the 'sell under' was that the item was also remaining in the closed auction section as well as showing up under the winner details. My user was able to relist or 'sell under' again if they chose to. Now with my code on the cron.php with the 's' the 'sell under' works correctly. It also shows an 's' in the database on the sold items.

Another issue this code fix seemed to solve is now when my items get relisted they don't show the old bid counts anymore and it starts fresh with zero bids.

My error log reads: Error log is currently empty after running the test! :D I will run some more test and check to see that everything is working properly.

Thanks Box Lot, DrJ, and Pani100! I will add some photos below this when I get back to my pc at home of what the yourauctions_c page should look like. Not all the checkboxes show up. The checkboxes for the items with one or more bids only show checkboxes under 'sell under' and 're-list'. The checkboxes for items with no bids only show the checkboxes for re-list and delete. I will share my js code when I finish running all the tests.

Give the 's' a try on the cron.php page. If that doesn't seem to work then clear your cache and set your cron setting to non-batch if it's not set that way.

Update: Here is the photo of what the yourauctions_c page should look like:
[ATTACH=CONFIG]2198[/ATTACH]

After further testing: It looked great at first but, now it's replicated the sold items in the winners details page. Each item is multiplying every 10 or 20 minutes. I checked the sold items tab and the items there and there is only one item listed for each one. It seems to be only in the Winners Details page that the items are replicating.
(0001207)
pani100 (reporter)
2014-02-26 07:11
edited on: 1970-01-01 00:00

Hi david62311, if you set
[PHP]// Close auction
$query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 's' WHERE id = " . $Auction['id'];
$system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);[/PHP]
then all auctions that close will be marked as sold and not show in user CP closed auctions from the following query

[PHP]$query = "SELECT COUNT(id) AS COUNT FROM " . $DBPrefix . "auctions
        WHERE user = " . $user->user_data['id'] . "
        AND closed = 1 AND suspended = 0
        AND (num_bids = 0 OR (num_bids > 0 AND current_bid < reserve_price AND sold = 'n'))";
$res = mysql_query($query);[/PHP]

Someone wrote

The bug in the 'sell under' was that the item was also remaining in the closed auction section as well as showing up under the winner details.

This is because when you press sell under price it would mark the item as sold (sold= 's') on yourauctions_c.php but straight after it would go into the cron and re-write it back to sold= 'y'.

Someone wrote

Another issue this code fix seemed to solve is now when my items get relisted they don't show the old bid counts anymore and it starts fresh with zero bids.

Haven't check that yet. Will wait until test auctions finish and see if they get reset again as they should.

Sell under price comes up when there is an auction with a reserve and the highest bid is bellow that reserve when the auction finishes. Then the seller has the option to sell it to the highest bidder even though the bid is below the asking reserve price.

Someone wrote

I coded the javascript codes for the checkboxes last week but, was missing the correct code on the yourauctions_c.php side

Have not looked at the js at all as was not needed yet. What did you find that was missing? Is it the check all boxes?
(0001208)
david62311 (reporter)
2014-02-26 20:44
edited on: 1970-01-01 00:00

Hi pani100,

Let me respond first to you pani on the 1st part. I understand what you are saying that every item closed should have an 's' in the sold part of the database. I haven't run test on that yet but, I can see what you are saying. I am going to send you the yourauctions_c.tpl file that I added the javascript on.

I had major problems with those duplicating items being made by the cronjobs that were being done. I will spare all the details but, in short when they were replicating they were charging fees too. I will lengthen this post a little and share some details.

I had 2 different things happening with 2 different user so, I will split them up into users. User 0000001 is my main user and user 0000002 is my back up user to run test on my page:

user 0000001> Sees only 4 outstanding payments listed but, owes over $200 from charge of items being replicated that were showing in the winnders details link and the total amount was rising every time the cron job ran. Replicated items in the Winner Details were charging me final cost fees. Sold items show only one item. User#1 doesn't see recent invoices. I am thinking this might of been because I gave user#1 $25 signup credit and it might of screwed something up there. I don't know why both users are different.

user 0000002> Sees 1800 items listed in the outstanding payments but, the charge for each of the same item is only charged once. user#2 only owes $19 for the few items bought ranging from $2 to $6. In the winner details, the I only see 2 items that have not been paid for by user#1 who bought the two items. In the Sold items tab, there are only two items sold. I sold those two items before changing the cron.php code last night. Nothing was replicated there. I also do not see these two items listed when I briefly browsed the 1800 items. In reality it was about 5 items replicated 1300 times but, they got repeated all at the same time so, the order never changed. This is why I only had to briefly browse the items.

The invoice issue is something I will have to look into later. I want to get my sell under working properly and not see cron jobs ran listed in my sold auction section anymore and to get the sold items displayed correctly in the database.

Update here:
The mess is cleared up. I had to go into webid_winners in the database and run an inline command to delete all of those replicated items. There was only about 70 pages....LMFAO. The old cron got me good! LOL

I ran this for each item in the query. I am not super skilled at doing it but, this didn't take long since it was only about ten items replicated a zillion times. Here's the code to delete an item from the webid_winners table in the database using an inline command:

Someone wrote

DELETE FROM `buffy123_webi123`.`webid_winners` WHERE `webid_winners`.`auction` = 136


Change the first part to whatever directory your database. buffy is just an example. Also, change the last number to whatever auction number you want to delete. For the record, the items I deleted were all test items. It would be a challenge to sort out real auction items.
(0001209)
pani100 (reporter)
2014-02-27 08:49
edited on: 1970-01-01 00:00

Update on findings:
With the closing of all the reserve auctions and the test query, all auctions seem to have moved over correctly and relist and sell under price appearing too.
The next problem as mentioned by david62311 is if I decide to sell under price the auction seems to not close correctly. Every time the cron runs because it has sold='s' it keeps inserting it over and over again in all relevant tables. Basically when cron starts, it checks to see which auctions need closing and that one is always in its list.
What I suspect is happening:
sell under price sets sold='s' in cp page and requests cron to run,
Now because cron can see the sold='s' in selects it for processing, it completes that and then sets the sold='y' to prevent it being processed again next time it runs.
So we need to change the sold='s' to sold ='y' after the auction has been processed.
This is starting to make sense now. :D

Next to test is this query:

[PHP]// Close auction
        if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }[/PHP]

This seems to move the auctions in the correct pages, and close them correctly.

To be continued...
(now we are getting all friendly with Mr cron, this could help to sort out the multi item problem:eek:)
(0001210)
david62311 (reporter)
2014-02-27 15:30
edited on: 1970-01-01 00:00

pani100;37460 wrote

Update on findings:
With the closing of all the reserve auctions and the test query, all auctions seem to have moved over correctly and relist and sell under price appearing too.
The next problem as mentioned by david62311 is if I decide to sell under price the auction seems to not close correctly. Every time the cron runs because it has sold='s' it keeps inserting it over and over again in all relevant tables. Basically when cron starts, it checks to see which auctions need closing and that one is always in its list.
What I suspect is happening:
sell under price sets sold='s' in cp page and requests cron to run,
Now because cron can see the sold='s' in selects it for processing, it completes that and then sets the sold='y' to prevent it being processed again next time it runs.
So we need to change the sold='s' to sold ='y' after the auction has been processed.
This is starting to make sense now. :D

Next to test is this query:

[PHP]// Close auction
        if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }[/PHP]

This seems to move the auctions in the correct pages, and close them correctly.

To be continued...
(now we are getting all friendly with Mr cron, this could help to sort out the multi item problem:eek:)


I tried your code an it spit up an error on my user page when I processed an item to sell under:

Parse error: syntax error, unexpected end of file in cron.php on line 503

503 is the end of the page.

The item is gone from the users side and not found in the winner details or as being sold. This page will still need to be worked on.

I will post here instead of posted a 2nd time. It makes it harder for people reading stuff when a thread goes to too many pages. I can't read 6 pages of stuff like I've seen some thread go.

My first throught of the database changing to a `y` or staying as a `n` was that it was just reporting a character. When I tried the `s`, I thought okay it's just going to change it to an `s`. I was surprised to see it seemed like it was working the way it was supposed to with `s` minus the cron jobs that kept replicating the items in the winner details page. I got the `s` not only from read the old post answer from box lot but, it was showing in the query on line 67.

Someone wrote

AND sold = 's'))";


It's also written like this on line 112:
Someone wrote

'reserve_price'] || $Auction['sold'] == 's'))


If we can use the 's' and stop the cron jobs from happening in the winner details page which is the selling.php page then it should function correctly when items being sold make it to the winner details page. My problem is I am not too familiar with cron jobs, but after she got me good yesterday, I better learn to handle her better.

Here's the test I ran last night using the 'n' or the 'y':

Set as 'n'
With no bid on Item:
Database records `sold` as `n`.
Relisted and closed item show it was an `n`

With it closed after one or more bids on item as 'n'
Can close items with more than 1 bid with no errors
Sell under>item disappears from close item table and goes to sold Items and also Winner Details
Remains as `n` under `sold` in database.
No items are replicated in Winners details by a cron job.



-----------------------------------------------------------------------------------------------------------------
Set as `y`
With No bid on item:
When it closes with or without bids, the Database records under `sold` column as `y`.
When item is closed the item show under the 'sold' column as 'y'

After using the sell under puts item in Sold section and in winner details but, also remains in the close section and can be re-listed or 'sell undered' again.
No repeats on the item in the Winners Details section by cron jobs.


-----------------------------------------------------------------------------------------------------------------
Here's the old test:
Set as 's'
Total chaos.

When I ran these test it seem to show a 'n' when the item closed with more than one bid.
It was in the right closed section.
When I sold it under price it went to the winners details and sold items correctly and displayed a 'y' in the database after it was sold.
The major issue was it replicated the items in the winner details charging fees. It did not replicate in the sold items.
I am going to run a couple of more tests on the 's' to see that my report here is correct about the databse reporting. If I do this in a timely manner then I should be okay. I'll be quick about it. I promise.

Update:
When I saw the winners table in the actual database, it had lot's a replicated items there. Maybe we can look around the query starting on line 211 where the note is:
Someone wrote

// Add winner's data to "winners" table


It had seemed to work right with the 's' but, what causes it to run the job more than once?. Why did is also send to the Sold Items page and not replicate there too? Maybe a while loop is repeating the issue. The item I sold this week and was paid for did not get repeated other than the initially time. He only had to pay for it once and it set my button to paid for in the winners details.
(0001211)
pani100 (reporter)
2014-02-27 19:32
edited on: 1970-01-01 00:00

Hi david62311,
 for the script to reach the end an ending bracket has been missed out.
I include the query again [PHP]// Close auction
        if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
        
    }

    // WINNER PRESENT[/PHP]

The logic is simple. A page marks auction as sold ='s' and calls the cron.php.
The cron.php sees the sold='s' and puts the auction into processing (add final fees, etc) and closing.
Once it has completed the above it immediately marks the auction as sold='y' so it will not keep processing it next time the cron.php runs.
The 's' is like a mark for the cron.php to process and close an auction
(0001212)
david62311 (reporter)
2014-02-27 19:43
edited on: 2014-03-02 19:54

Maybe those two different while loops in the selling.php page have something to do with it? That is the first time I have ever seen $rr used in the webid script. I usually just see the $res Then towards the bottom of the while loop with the $rr there is this. $i++ . Update...I learned the ++ means 10.

Wouldn't the $i++ just keep adding or replicating items? What if we make the $i = 0 like the other one? I gave it a try with the cron set at 'n' on line 291. Then checked an item and sold under and it went to the sold items page and winners details page fine. Now let me watch it to see if it replicates in 10 or 20 minutes. I will run some more test to check the database to see what it's doing.
(0001213)
pani100 (reporter)
2014-02-27 20:06
edited on: 1970-01-01 00:00

david62311;37478 wrote

Maybe those two different while loops in the selling.php page have something to do with it? That is the first time I have ever seen $rr used in the webid script. I usually just see the $res Then towards the bottom of the while loop with the $rr there is this. $i++

Was this posted in the wrong thread?
$rr is just a variable name, you can use anything but don't go changing things around as any small changes have big effects further down the line (not seen straight away) or have been put there for a reason.
(0001214)
david62311 (reporter)
2014-02-27 20:36
edited on: 1970-01-01 00:00

OMG...I am running test and not refreshing my page here and didn't see your other post.

Right...I was wrong to mention the $rr. I'm just worn out from this 'old cron' page. This will probably be the hardest issue I will ever deal with on the webid script. I will tell you, I don't quit trying to get stuff to work properly until it's done.

I edited my answer above before reading your last two post. I didn't see your post.

The $i++ looks like it could of repeated the cron jobs. I changed it to $i = 0 . Experimenting is a great way to learn. That's what I am doing. Experimenting. When I changed that $rr to $res the winner details page had the same item repeated multiple times but, no extra charges were charging me. I changed it back to $rr and then I made sense that the variable could be whatever you want it to be. My experiment though, made me realize I was in the right area. I've tested my change to the $i = 0 with the code on the cron page set at 'n' and now 'y' and it wasn't correct. I will share the details later. I am going to test it with the 's' now and I will watch to see if my items repeat in the winners table. If they do replicate, then I will try your code at the end on page 2. Let me just finish up this experiment. I got a hunch the 's' will work this time. If it doesn't then, at least I gave it a try and I can rule it out.

Result->My 's' test failed. I will try your code now.
(0001215)
david62311 (reporter)
2014-02-27 20:53
edited on: 1970-01-01 00:00

pani100;37477 wrote

Hi david62311,
 for the script to reach the end an ending bracket has been missed out.
I include the query again [PHP]// Close auction
        if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
        
    }

    // WINNER PRESENT[/PHP]

The logic is simple. A page marks auction as sold ='s' and calls the cron.php.
The cron.php sees the sold='s' and puts the auction into processing (add final fees, etc) and closing.
Once it has completed the above it immediately marks the auction as sold='y' so it will not keep processing it next time the cron.php runs.
The 's' is like a mark for the cron.php to process and close an auction


I used your code. I will run some tests and let you know if it works! Thanks! :)

Give me a few though. I got another mess to clean up in my database.
(0001216)
david62311 (reporter)
2014-02-27 21:12
edited on: 1970-01-01 00:00

I ran a test on your code.

I had an open test item. I placed a bid on it. I closed it when I check the checkbox in the active auctions and processed it. Just a note: The seller really shouldn't be able to do that when there is a bid on an item nor should the seller be able to bid on their own item. Maybe I am causing some issues bidding on my own thing. I will try again with another item but, this time I will use my other user.

I reverted an old code back which I thought I had reverted before back to the original on another page and now I am changing my test result.

My result-> PASSED

I will run some more test and get back to you! Thank you pani100!
(0001217)
david62311 (reporter)
2014-02-27 21:55
edited on: 1970-01-01 00:00

david62311;37482 wrote

I used your code. I will run some tests and let you know if it works! Thanks! :)

Give me a few though. I got another mess to clean up in my database.


The code you game me for line 291 on the cron.php works. I ran more test. It works GREAT! Thanks! Here's what I did for my tests.

I relisted one of my test items.
I placed a bid on it with my own user. (Again the seller should be able to do this)
I closed the item with my own user. (Again the seller should be able to do this when there is one or more bids)
When I saw the item in the closed item page (yourauctions_c page) I checked the database. It showed an 'n' under the sold.
When I checked the checkbox for the item and 'sold under' and processed it, it sold and went to the winners details page and the sold items page. I checked the database again and this time there was a 'y' there.
Best of all there is nothing replicating in the winners details charging up extra fees to my sellers.

As far as I can tell your code works! GREAT JOB! I am giving you a standing ovation here pani100! [ATTACH=CONFIG]2200[/ATTACH]

I don't know what webid would do without you! Now we can relax a lot tomorrow. :)

Even though renlok did a lot pdo work on the cron.php page, go ahead and please add your code when you feel comfortable doing so to the webid github site! He only moded some stuff on the cron.php page, he didn't change the code where you coded.
(0001218)
pani100 (reporter)
2014-02-28 11:49
edited on: 2014-02-28 11:49

david62311 wrote


As far as I can tell your code works! GREAT JOB! I am giving you a standing ovation here pani100! [ATTACH=CONFIG]2200[/ATTACH]

Thanks david62311, its good we solved this one. Now on to the next one: multi item closure. The have to do list is reducing
(0001219)
david62311 (reporter)
2014-03-01 01:08
edited on: 2014-03-01 04:01

I did some further testing and I hate to bring this up.

I just closed an active item with no bids and in the database under the sold there is a 'y' there under the sold column.

Here's all the test I ran. Item 0000003 & 0000004 is the one that failed. The other stuff checked out.

I relisted a bunch of test items.
[LIST]
[*]Item 0000001: One auction item just closed a few minutes ago with one bid I made from another user. The item went to the closed table. It read 'n' in the database. This is working fine.
[*]Items 0000003 & 0000004: no bids - I closed the two items manually from the active auctions tab and checked the database and, it went from and 'n' to a 'y' as being sold when I closed it.
[*]Item 0000005 : I placed a bid on the item with one bid. I closed this manually. The database reads 'n' under the sold. This works correctly.
[/LIST]

All of the items that close on their own or manually come up with a 'y' under the sold column in the database.
(0001220)
pani100 (reporter)
2014-03-01 09:29
edited on: 2014-03-01 09:35

david62311 wrote

I did some further testing and I hate to bring this up.

I just closed an active item with no bids and in the database under the sold there is a 'y' there under the sold column.

Here's all the test I ran. Item 0000003 & 0000004 is the one that failed. The other stuff checked out.

Hi david62311,
Can you add more details on the problem, as I can't see what is wrong.
Just to make it clear any auctions that are closed will get marked as sold='y'.
If they have sold='n' then the auction will still be running.
And the sold='s' is a temporary mark up to tell the cron to process and close the auction.
Pressing close now will end the auction and mark it with sold='y' BUT it will end up under the closed tab if no bids have been made.
The sold can only be 3 states. To determine if the item is actually closed or sold other tables come into play too.
 When you close an item that would of been relisted again (if you let it run) it cancels all the relists too.

Just read the post again and I think I can see where you are getting confused maybe.
Setting the auction as sold='y' does not mean that the auction has been sold (see the sold='y' as a secondary closed column).
 For an auction to be actually closed there are other tables that are looked at like winners table
(0001221)
david62311 (reporter)
2014-03-01 14:34
edited on: 2014-03-01 19:03

Hi pani100,

I am just waking up and haven't had my caffeine yet. It hasn't sunk in what you are telling me. Are you telling me the 'y' under the sold column in the database doesn't mean sold and that it could also mean closed?

This is what I was trying to say: Every active item that closes whether it closes on it's own after the time runs out or I go to the active auctions and check the box and use the 'close now' seems to get a 'y' in the database under the sold column. Doesn't the 'y' mean sold?

Can you understand what I am saying now? Couldn't that cause some issues if something calls on that?

Your code from before seems to run great. It was just the 'y' in the sold column that was bugging me. How can I tell if an item is sold or not in the database when an items gets sold is a 'y' and the closed items are a 'y' too? There should be an 'n' there for closed items right? All of my closed items that had one bid on them had an 'n' after they closed on there own or I manually closed them.
(0001222)
pani100 (reporter)
2014-03-02 09:31
edited on: 1970-01-01 00:00

david62311 wrote

Hi pani100,

Are you telling me the 'y' under the sold column in the database doesn't mean sold and that it could also mean closed?


Hi david62311, Yes thats what I mean. It is the actual name that is confusing but it is only a name.
(Hope this doesn't seem more confusing)- I suppose you could say the sold= ... will tell us if an auction is open or closed.
It directly controls the closed column, (but it is not the only thing controlling the closed column)
 
If you do a search through the script to see where the sold column is used you will see it is only on 1 or 2 pages (yourauctions.php range and the cron.php. This does not tell us if an auction has been sold, it is only a little helper for us (but big for cron.php as cron relies on it ).
To determine if an auction has sold there are other tables we use.
(0001223)
renlok (administrator)
2014-03-02 18:08
edited on: 1970-01-01 00:00

Hey pani so the the fix you posted
[PHP]// Close auction
        if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
         
    }

    // WINNER PRESENT[/PHP]
is this the working fix?

Sorry im being lazy not read through the thread
(0001224)
pani100 (reporter)
2014-03-02 18:17
edited on: 1970-01-01 00:00

renlok wrote

Hey pani so the the fix you posted
[PHP]// Close auction
        if ($Auction['sold'] != 's' AND $Auction['num_bids'] > 0 AND $Auction['reserve_price'] > 0 AND $Auction['current_bid'] < $Auction['reserve_price']) {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'n' WHERE id = " . $Auction['id'];
        } else {
        $query = "UPDATE " . $DBPrefix . "auctions SET closed = 1, sold = 'y' WHERE id = " . $Auction['id'];
        }
        $system->check_mysql(mysql_query($query), $query, __LINE__, __FILE__);
         
    }

    // WINNER PRESENT[/PHP]
is this the working fix?

Sorry im being lazy not read through the thread

Hi renlock,
yes it is doing the corrections needed
(0001225)
renlok (administrator)
2014-03-02 19:40
edited on: 2014-03-02 19:40

OK awesome work I added the fix to git
(0001226)
david62311 (reporter)
2014-03-02 19:53
edited on: 2014-03-02 20:04

Sorry, pani100, the problem seems to be on my end where my auctions end up with a 'y' under the sold when the close with 1 or more bids. I tried your fixed code on an install that is sort of fresh. The code is now showing a 'n' in the database when an item closes with a bid or not. Without your code change, the item I closed with one bid on my freshly installed webid never made it to the closed auctions section. It was showing a 'y when it closed with 1 or more bids too. With you code the code works and fixes all the problem. With your code the item with more than one bid closed and had a 'n' in the database under the sold. I clicked the 'sell under' and it put a 'y' there. So, your code works. I will have to figure out what page of code I added a while back on the main webid page. Don't worry I will find it. I have a feeling I know where it is.

I started to understand how everything worked last night. Mostly from experimenting around. I will make this short and not get into details.

[LIST=1]
[*]The items goes to the yourauctions_c page when it closes.
[*]If it gets sold the query on line 78 of the yourauctions_c.php page SETs it as an 's'. $query = "UPDATE " . $DBPrefix . "auctions SET sold = 's'
[*]On the yourauctions_c.php page it then connects to the cron page on line 81. include 'cron.php';
[*]On the cron.php page it runs a query and selects the 's' on line 67. AND sold = 's'))";
[*]Then it goes down to line 141 on the cron.php and runs a query and inserts the sold items into the winners table
[*]It was supposed to then turn the 's' into a 'y' where you put the code if it got sold on after line 290 on the cron.php page.
[*]pani100...you change the code on the cron.php page to make it go from an 's' to a 'y' in the sold column of the auctions of the database.
[/LIST]

pani100, how am I doing for an experimenter/tester? I ran an experiment and removed the include to the cron.php on the yourauctions_c.php page to see what happened and then I noticed the 's' in the database when I sold an item and it didn't INSERT anything into the winners details or sold items links. Then I figure out what the cron.php did. Then it started to make sense what you were talking about to make the 's' SET to a 'y'. Then I just had fun tracing it all down and figuring it out.

I think I figured out why it repeated too when I just put an 's' there. It had to be changed and SET to a 'y' or anything else but, an 's'. I believe it ran a cron job again and went back to line 67 on the cron.php page and selected the 's' again and ran everything again and got into a scheduled looping process.

The question though. Why did it only insert the item only once on the sold items and repeatedly added to the winners details? I will do some more experimenting and see why that was.
(0001227)
pani100 (reporter)
2014-03-02 20:15
edited on: 1970-01-01 00:00

david62311 wrote


The question though. Why did it only insert the item only once on the sold items and repeatedly added to the winners details? I will do some more experimenting and see why that was.

Hi david62311, you got it then. Experimenting is the best way to learn.
 Why did it only insert the item only once on the sold items. Do you mean in auction? it will only update a known auction line every time. On the winners because not closed it thinks its a new auction for proccessing and creates a complete new line in the winners table // Add winner's data to "winners" table
            $query = "INSERT INTO " . $DBPrefix . "winners VALUES

- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 464
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2013-10-02 15:45
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2014-03-02 20:15
2015-04-01 17:20 renlok File Added: reserve.jpg
2015-04-01 17:20 renlok File Added: closed items webid.jpg


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker