Login Form

#789 – still problem with Watchlist emails?

Posted in ‘BF Auction’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Monday, 25 January 2016 22:48 AEDT
minbori
Joomla! version: 2.5
BF Auction Plus: 1.9

Hi Tim, sorry to bring this up again, but I'm still encountering this problem: Watchlist "24 hours to go" reminder emails are being sent to bidders EVERY TIME they place a bid within the 24 hours to go time period.

We talked about it in a couple of tickets last year:

http://tamlynsoftware.com/contact-us/support-tickets/bf-auction/544-24-hours-left-to-bid-notices-sent-out-to-bidder-when-auction-closes-with-buynow.html

http://www.tamlynsoftware.com/contact-us/support-tickets/bf-auction/571-too-many-watchlist-emails-being-sent-worried-for-our-end-of-auction-tonight.html

It seems to me that both the code fixes suggested in those tickets exist in the 1.9 version. But the behavior still persists :-(
 
Thursday, 28 January 2016 22:18 AEDT 10'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Can you take a look at the jos_bfauction_watchlists table, and see if the emailSent field is getting changed from 0 to 1, and is the emailDate still showing 0000-00-00 00:00:00 or is it showing the date/time that the watchlist email was last sent.

regards

Tim
Follow us on twitter http://twitter.com/tamlynsoftware
Thursday, 28 January 2016 22:53 AEDT
minbori
Here's a sample from my test data. As you can see, each user is getting mailed multiple times for the same items.

The emailSent fields are all set to 1, and there are timestamps for when each mail was sent.

 
Friday, 29 January 2016 10:20 AEDT 5'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Looking at the code in /components/com_bfauction_plus/controller.php, the only place where the watchlist email is triggered seems to only select those records where emailSent = 0, and sends emails to those and updates the record (refer to code below).

//around line 1358
				$query->select('id');
				$query->from('#__bfauctionplus_watchlist');
				$query->where('itemid = '.$row->id);
				$query->where('emailSent = 0');

				$db->setQuery((string)$query);
				$rowsWatchlist = $db->loadObjectList( );

				foreach($rowsWatchlist as $rowWatch){
					bfauction_plusController::triggerEmails("Watchlist", (int)$rowWatch->id, NULL);


So I'm not sure how these could send multiple times. Does the code on your site look like above?

regards

Tim
Follow us on twitter http://twitter.com/tamlynsoftware
Saturday, 30 January 2016 03:04 AEDT
minbori
Hi Tim, I'm not sure either, that's why I'm asking :-)

Here's lines 1373 through 1410 in my /components/com_bfauction_plus/controller.php

------------------------------

// Check to see if any watchlist emails need to be sent for this item
//is it less than 24 hours before auction ends
if ($adjustedEndDate > $row->endDate){
$db = JFactory::getDbo();
$query = $db->getQuery(true);

$query->select('id');
$query->from('#__bfauctionplus_watchlist');
$query->where('itemid = '.$row->id);
$query->where('emailSent = 0');

$db->setQuery((string)$query);
$rowsWatchlist = $db->loadObjectList( );

foreach($rowsWatchlist as $rowWatch){
bfauction_plusController::triggerEmails("Watchlist", (int)$rowWatch->id, NULL);

$rightNow = JFactory::getDate();
$db2 = JFactory::getDbo();
$query2 = $db2->getQuery(true);
$query2->update('#__bfauctionplus_watchlist');
$query2->set('emailSent= 1');
if(is_callable(array('JDate', 'toSql'))){
$query2->set('emailDate='.$db2->quote( $db2->escape( $rightNow->toSql() ), false ));
}else{
$query2->set('emailDate='.$db2->quote( $db2->escape( $rightNow->toMySQL() ), false ));
}
$query2->where('id = '.(int)$rowWatch->id);

$db2->setQuery((string)$query2);
$db2->query();
if ($db2->getErrorNum())
{
echo JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $db2->getErrorNum(), $db2->getErrorMsg()).'<br />';
return;
}
}
}
 
Saturday, 27 February 2016 06:29 AEDT
minbori
I think I may have found the problem -- it may be a bug, though I can't imagine nobody else has come across this before.

My problem is that every time a bidder places a new bid inside the 24 hour watch period, they get a bid confirmation IN ADDTION TO a watchlist "24 hours to go" email.

Here's what I see happening in controller.php:

1. When a bid is placed, the
myBid()
function calls the
watchlist()
function around line 400:
//add item to watchlist
$this->watchlist( (int)$itemId );


2. The
watchlist()
function ALWAYS inserts a new row into the #__bfauctionplus_watchlist table.

3. The
triggerBFAuctionEmail()
function is called AFTER the previous actions have been taken, so by the time the SQL query inside triggerBFAuctionEmail() checks, there is ALWAYS a row with a emailSent = 0 value for that user/item combination -- even if there are already other rows showing that user/item combo with emailSent=1.

I put some code into the
watchlist()
function that first checks to see if there is already a row in the #__bfauctionplus_watchlist table that has the same user/id combination as the current bid, and an emailSent flag set to 1. If one or more of these rows already exist, there is no insert made.

This seems to have solved the problem of the multiple watchlist emails being sent; I'm still testing to see if this has effects on the other types of emails. I'll keep you updated, but I'd appreciate any thoughts you might have. There may be a better or more elegant solution, and I'm not convinced I haven't broken something else :-)

 
Tuesday, 01 March 2016 03:46 AEDT
minbori
Well, my auctions have finished and although my watchlist email problem is solved, and there were no DUPLICATE emails sent out (like last year), this time too FEW emails were sent. Here's the result:

Auctions with a winning bidder (reserve price met):
-- All winning emails sent correctly
-- Only ONE losing bidder in the auction received a "Losing Email".

Auctions which did not meet reserve:
-- Only ONE bidder, the first bidder, was sent the "ReserveNotMet" email.

Please help, I really like this extension except the mailing functions are making me tear my hair out!
 
Saturday, 30 April 2016 11:21 AEST 5'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Closing old tickets. If you still have an issue, please raise a new support ticket.
Follow us on twitter http://twitter.com/tamlynsoftware
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.
Go to top