6

Ok, what I'm trying to do is build a feature for a real estate website that will allow users to do the following:

  • register on the site,
  • do a search of properties stored in a channel,
  • save the search criteria,
  • then receive an email alert when a new property is added that matches their saved search

I've done some research on this and there doesn't seem to be a straightforward way to do this in EE. I've seen MX Notify Control addon but it seems that this would alert on all new entries to a channel to all users.

Below is what I'm thinking of doing. I'm hoping I could get some input from the EE community on what they think of this approach, is it overcomplicating things or maybe there's a suggestion for a better approach.

Here goes:

  • Install Solspace Super Search and Email-from-Template addons
  • Allow users to register on the site using native EE functionality
  • Users can then search the entries in a "Property" channel based on keyword, price, location and/or status.
  • Then allow users to save their search using Solspace Super Search and their Save Search Form tag
  • I could create a standalone page then that loops through all saved searches using the exp:super_search:history tag, pull out the search criteria, use that criteria to do a search of the property channel and limit the results to ones added in the last 24 hours only.
  • If entries are retrieved, create an html email with the property details and send the mail using Email-from-Template addon or possibly through Postmark App or similar.
  • Set up a cronjob to run this page every 24 hours at a quiet time of the day, e.g. 4am

So, that's what I'm thinking. I know this page could become quite resource intensive with loops within loops (the more members and saved searches, the longer it will take to process) but I can't think of another way to do this.

Anybody got any suggestions, ideas or pitfalls I should consider?

Or maybe I should write a custom addon to do this?

Thanks,

Dave

4
  • What is your experience or comfort level like with building custom add-ons? Commented Dec 2, 2012 at 21:27
  • How is the data stored for the saved searches? Is it in its own table, or are they channel entries? Also, do you want to search upon listing using geolocation, or just keywords? Commented Dec 2, 2012 at 21:44
  • @erik I've written a couple of small plugins. Nothing major. I have devs on my team that have more experience.
    – davidbehan
    Commented Dec 2, 2012 at 22:46
  • @justin I don't know how the data is stored. I could just store the conditionals in a separate channel. Geolocation won't be needed I don't think. Just keyword based.
    – davidbehan
    Commented Dec 2, 2012 at 22:52

4 Answers 4

5

Not a complete answer though, I feel it could be one piece of the puzzle or at least an option.

Have you checked out Postmaster yet?

http://devot-ee.com/add-ons/postmaster

Postmaster is the definitive solution for emailing channel entries within ExpressionEngine. Create beautiful email templates using the live preview, and impose extremely fine levels of control to send emails exactly when you want. Whether it be from the publish entries page in the control, to Safecracker on the front-end, or in a custom application using the channel entries API, Postmaster is the perfect for almost any application.

Postmaster supports a variety of email services including MailChimp, CampaignMonitor, SendGrid, Postmark, PostageApp, and even a full featured API to create your own.

5
  • 1
    Postmaster v1.2, the next major release that is in beta would make this pretty easy. However, I can't recommend it a viable solution due to it not being properly documented or actually released yet. Either way he goes, he going to need to write some code. Commented Dec 2, 2012 at 21:49
  • @justin I've been reading your site about Postmaster and it feels like it's got a lot of what I want, but not everything. If you've got more features in 1.2, I'd love to know more. Could I buy a copy? Or when do you expect to be releasing it?
    – davidbehan
    Commented Dec 2, 2012 at 23:01
  • @davidbehan Feel free to email support[at]objectivehtml.com and I will give you a breakdown of the beta. v1.2 is really powerful and extendible and works with any EE hook. Postmaster's API's were built specifically for what you are trying to do - in that you need a solid foundation capable of sending email with any service - but you just need to dictate specific when and where that email is sent. I think it could definitely work. Commented Dec 3, 2012 at 1:16
  • Followed up with Jason via email. Will report updates on how we get on. Thanks.
    – davidbehan
    Commented Dec 3, 2012 at 21:34
  • Postmaster v1.2 has been released FWIW.
    – Natetronn
    Commented Dec 23, 2012 at 3:34
2

I created similar functionality for a website a while back with a mix of PHP and EE template tags to get the results I needed. I'm not sure if there's a magical all-in-one solution that exists yet.

I'm simplifying here, but I essentially got this to work similar to the way you are describing in your question, with some differences:

  • I created a db table that was used to store the contact info (I didn't have members, so I stored their provided email address), the query string that passed to Super Search, and a timestamp.

  • I ran through that table using the query module. Nested within that, I used the super_search:results tag - passing along the search query string. In each loop of the query module I compiled the email to be sent and sent it using the Postmark CodeIgniter wrapper.

I didn't have many users I had to process (under 10 at a time), so I cannot comment on the scaleabillty of it. For my purposes it seemed to work well enough though.

2
  • Glad to hear that this approach is possible. I'm going to contact Justin and see if Postmaster can do the majority of the work and fallback to this approach if not. I am concerned with scaleability with this approach but probably wouldn't know until trying. Thanks.
    – davidbehan
    Commented Dec 3, 2012 at 21:31
  • Postmaster will definitely be a good route to go. Good luck!
    – Carlos
    Commented Dec 3, 2012 at 21:39
1

Hmm, i'm not familiar with how solspace saves it's search, but i'd say you could achieve what you need in a template in the way you describe, possibly with a little bit of php thrown in too. How resource intensive it is will all depend on how many properties / saved searches you have and how complex your template is too.

So, onto a add-on, well you could create one with an ACT id for your cron to hit, that way you would avoid the whole EE template parser to do your job so it would be much more efficient. Of course, dependent on how Super Search stores it's data, you would need to decode that and work it into your queries / data structures that you're using to match new properties with.

So, i think doing it in a template with a little bit of php would be much much less work for you, and i doubt the processing overhead would be anything to worry about unless your site is likely to see an awful lot of users or you're running it on really low powered shared hosting. On the other hand, the add-on route would be lots more work for you, but be much more efficient.

Your choice depends on your expected site usage i guess. I hope that answers your question adequately!

1
  • I'd like to avoid the custom addon route if I can. The site won't have to much traffic in the grand scheme of things. Maybe a few hundred members with 2/3 saved searches each. Thanks for the input.
    – davidbehan
    Commented Dec 2, 2012 at 23:10
-1

Did you succeed to reach your goal on this?

If so, do you agree to share here your final thoughts/experience on how you achieved your goal?

I have something very similar to do.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.