cron email - best practice?

Status
Not open for further replies.

joit

Active Member
I'm working on a site where users can insert offers and requests of a product. I want to cron email them when there are accordant entries.
I thought about setting this up the way that there are 2 similar tables. One for offers, the other for requests. When some records of correspondent elements are equal or similar, an email should be sent.

Is the way I want to set this up a good idea?
Which tutorials, elements or plugins would you recommend to get it done?

Thanks in advance!
 
Hi

Often you have to end up coding this type of specific logic. I think I'd need a more detailed explaination to give you more detailed info, but in general it would involve creating the query that would find the matches and then emailing them, but of course the devil is in the detail - exactly what criteria would you need a match on to produce relevant matches?
 
I just need to compare elements of the same type. These elements would be googlemap, date/time and probably database join (dropdown). So I guess I would compare a googlemap element of one table to a googlemap element of another table etc.
It would be great if I could adjust whether only exact matches or similar values are concidered as matches.
 
You should be able to select matching rows with something like this:

SELECT tableA.* FROM tableA, tableB WHERE tableA.foo = tableB.foo AND tableA.bar = tableB.bar

As for "similar values" ... what exactly do you mean? For instance, are you talking about "similar" map locations? Like locations from table B within a certain radius distance of locations on table A?

You won't be able to use the 'email' cron plugin. Well I guess you could, by using the 'Condition', and matching each row of tableA against tableB in a per-row query, but that would be very expensive.

So I would suggest a PHP plugin, where you manually perform that query, and manually send the mail. Most of the code could be borrowed from the email plugin.

-- hugh
 
You won't be able to use the 'email' cron plugin. Well I guess you could, by using the 'Condition', and matching each row of tableA against tableB in a per-row query, but that would be very expensive.

Yes, this is what I thought I could do. I can't write php and only have some css and html experience.
What exactly do you mean with expensive? It could take a long time to go through the whole table? Is this a problem if you have 1000 or 1.000.000 rows? Would the website's user interface hang during this process?
Mabe I could set the schedule to only browse the tables at night?
 
The "Condition" code is run in PHP for every row in the list.

In other words, we select all the rows (subject to any pre-filters) for the table you specify in the cron plugin setting, and pass all the selected rows in to the email plugin as an array of row data. The email plugin then loops round that array, and sends email (or not), subject to any "Condition" you may come up with.

If that "Condition" involves a database query - in this case, to see if there are any rows in your other table that match, then that means you'll be executing as many database queries as there are rows in your main table. how many rows that is obviously depends on your app, and what kind of volume you are expecting. But if that's in the thousands, obviously that's "expensive", and would almost certainly be way too inefficient to run.

Hence you should almost certainly code this as a PHP cron plugin, and do it as one query which hands you back all matching rows at once.

-- hugh
 
The "Condition" code is run in PHP for every row in the list.

In other words, we select all the rows (subject to any pre-filters) for the table you specify in the cron plugin setting, and pass all the selected rows in to the email plugin as an array of row data. The email plugin then loops round that array, and sends email (or not), subject to any "Condition" you may come up with.

If that "Condition" involves a database query - in this case, to see if there are any rows in your other table that match, then that means you'll be executing as many database queries as there are rows in your main table. how many rows that is obviously depends on your app, and what kind of volume you are expecting. But if that's in the thousands, obviously that's "expensive", and would almost certainly be way too inefficient to run.

Hence you should almost certainly code this as a PHP cron plugin, and do it as one query which hands you back all matching rows at once.

-- hugh
 
Seems like I should hand this over to the experts ;-)
Going to pm you with some details.
 
Usually better to catch me on Skype ('cheesegrits'), so we can discuss details right away rather than going back and forth over PM / forum.

-- hugh
 
I tried to contact you several times last week but there was no response. Please tell me when would it be a good time to talk?
 
Hi Hugh,

I tried to contact you for serveral days. Just want to know how the progress is. We're working on this for half a year now, just let me know if I can do anything to speed it up.
 
Apologies for not responding to your Skype contacts. I've been dealing with a serious family issue for the last couple of weeks. The person in question died early this morning, so I'll be back on track in a day or so.

-- hugh
 
Its preferable to use the new chat support (found in the bottom right of the main site) which will try to contact either me or Hugh.
 
I think the zopim chat might not work correctly. I tried to use it many times, once Rob answered but then I was there too late. The other times noone answered
 
well we aren't online permanently :) - i see a history message from you, but perhaps we weren't on-line at the time? I'm on-line for the next 7 or so hours so try again
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top