WeBid Bug Tracking - WeBid
View Issue Details
0000240WeBidEmailpublic2011-03-09 13:092016-04-25 14:19
dkmullen 
renlok 
@0@minorhave not tried
resolvedfixed 
1.0.1 
1.2.01.2.0 
242
0000240: Undefined variable: winner_array in cron.php - winner emails not sent
When an auction ends and there is a winner, the "you win" email is not being sent to the winner/buyer. I've tracked the problem down to the section of cron.php where endauction_youwin, endauction_winner and endauction_nowinner emails are generated. endauction_winner and endauction_nowinner work fine. endauction_youwin never even gets a chance to work because the array winner_array is not getting defined. The endauction_youwin section first runs through:

[FONT="Courier New"]if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)

[/FONT]

but because $winner_array is undefined it never gets through there.



For testing purposes, I changed the above line to:

[FONT="Courier New"]if (2>1)[/FONT]

to ensure that we would get through that if statement. When we do get through that if statement then we get an error in the error log saying that winner_array is an undefined variable.



Though I dabble in lots of technical stuff and programming languages, I'm not fluent in this particular stuff so I don't know how to fix or further test this winner_array problem. Any ideas?



Thanks in advance!



-Desmond
No tags attached.
Issue History
2015-04-01 13:17renlokNew Issue
2015-04-01 13:17renlokimport_id => 242
2015-04-01 13:17renlokDate Submitted2015-04-01 13:17 => 2011-03-09 13:09
2015-04-01 13:17renlokLast Update2015-04-01 13:17 => 2011-03-17 01:47
2016-04-24 14:16renlokTarget Version => 1.2.0
2016-04-25 14:19renlokStatusnew => resolved
2016-04-25 14:19renlokFixed in Version => 1.2.0
2016-04-25 14:19renlokResolutionopen => fixed
2016-04-25 14:19renlokAssigned To => renlok

Notes
(0000578)
Box Lot   
2011-03-09 15:45   
(edited on: 2011-03-09 15:49)
Can't replicate.

With a standard auction the winner does receive an email. However, the sellers payment details (S_PAYMENT) are missing from the email.

I used html format though that shouldn't make a difference. Report back if it does for some reason.

EDIT:
I see the payment details issue is because it is never set anywhere though there is a database field in the table. I would have to give it some thought what should be sent directly to the buyer if anything. Address, for example, might be different from mailing address and/or seller might not accept mailed payments so sharing the address is out of line.
(0000579)
pamotos   
2011-03-09 17:06   
(edited on: 1970-01-01 00:00)
i dont know if its the right place to post, but the endauction_winner email is not working for me... buyer receives email, seller doesnt.
(0000580)
dkmullen   
2011-03-10 01:51   
(edited on: 2011-03-10 01:53)
Box Lot,

Here are all the references to winner_array in my cron.php. Please let me know if they're the same as yours. As I said, by the time cron.php gets down to the isset and is_array and count bits, winner_array is undefined so it never gets through that if statement and doesn't have the info to send the winner's email.

[FONT="Courier New"] $winner_array = array();
        
        $Winner = mysql_fetch_assoc($res_n);

        $winner_array[] = $Winner; // set array ready for emails

        if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)
        {
            for ($i = 0, $count = count($winner_array); $i < $count; $i++)
            {
                // Send mail to the buyer
                $Winner = $winner_array[$i];[/FONT]
(0000581)
Box Lot   
2011-03-10 02:08   
(edited on: 1970-01-01 00:00)
All the references or a section? Line numbers?

Not sure what this is but if it is a section it is not in my cron.php.

My cron.php is 1.0.0.
(0000582)
dkmullen   
2011-03-10 02:32   
(edited on: 2011-03-10 02:33)
These are just the individual lines that have winner_array in them. I've shown where $winner_array is first initialized, then were $winner_array[] is populated with $Winner (and I included what $Winner was initialized with). And then there's the part of the If statement that actually does the sending of the youwin email to the winner.

Here it is again with line numbers. Note that doing a search for 'winner_array' is a better way to find these because the line numbers in my file might be different from in yours. My cron.php is from a clean installation of 1.0.1:

[FONT="Courier New"]158 $winner_array = array();

183 $Winner = mysql_fetch_assoc($res_n);

189 $winner_array[] = $Winner; // set array ready for emails

295 if (isset($winner_array) && is_array($winner_array) && count($winner_array) > 0)
296 {
297 for ($i = 0, $count = count($winner_array); $i < $count; $i++)
298 {
299 // Send mail to the buyer
300 $Winner = $winner_array[$i];[/FONT]
(0000583)
dkmullen   
2011-03-10 02:37   
(edited on: 1970-01-01 00:00)
Here is my entire cron.php file. Note that I've made a couple of fixes in this file (sql syntax issues). Those fixes are notated with a comment line that has my initials, DKM.
(0000584)
dkmullen   
2011-03-10 02:38   
(edited on: 2011-03-10 02:39)
cron.php as a text file (so it could upload)


edit: My bad! I thought I had to post a message while uploading a file...
(0000585)
pamotos   
2011-03-10 03:19   
(edited on: 1970-01-01 00:00)
if i use buy now only does the seller receive an email?
(0000586)
dkmullen   
2011-03-10 03:29   
(edited on: 1970-01-01 00:00)
pamotos wrote

if i use buy now only does the seller receive an email?


I don't know off-hand. I would assume the seller would receive an email no matter what way his/her item was sold. This discussion centers on defining the variable/array "winner_array" in cron.php. You might want to do some testing yourself or do some searches on the forum, maybe especially the General Support forum.
(0000594)
dkmullen   
2011-03-17 01:47   
(edited on: 1970-01-01 00:00)
My site is live now. It is a single-seller site (a non-profit) so I can simply manually send out emails to the winners as auctions end. This isn't, however, a reasonable solution for the long run. Can anyone me diagnose this problem? What reasons could there be that winner_array isn't getting defined?

Thanks to all!

P.S. The site is here: http://penniesforchange.net/auctions/" [^" title="]]http://penniesforchange.net/auctions/[/URL] [^]