I am contemplating on using this module, but am at a loss as to how to search the data like a normal real estate search. I see the search API module works with this data, but are there any examples? Especially allowing the user to pull listings that meet their needs: price range, bedroom count, area, garage....
What about a search view that gives the user a set of custom controls for implementing a real estate search?
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | Bedroom select.png | 12.04 KB | droddis |
| #24 | cville.png | 14.46 KB | j9 |
| #23 | cville.png | 15.14 KB | j9 |
Comments
Comment #1
twodYou could set up a View based on the Drealty Listings entity types you have, with some exposed filters to let users filter out listings based on those criteria.
Comment #2
kevinquillen commentedYou can use Views out of the box. However, I have a feeling you are asking about how the View fields are presented to the user. You can do a simple price range by adding Price filter twice, one being greater than or equal to, and one being less than or equal to. But, its still text entry.
Here is some common code I use to 'pretty up' Views form filter interfaces for the end user. You may have to modify parts of it so it works for you, such as field names, form IDs, etc.
What I am doing below is making texts into selects, and populating the options with values from the database for city and property type. I am also creating price options as well.
Comment #3
kevinquillen commentedThe price fields are commented out, but they do work- I just did not need them on the project I am working on (yet).
Comment #4
kevinquillen commentedChanging status. If this works for OP, I will open up a task for Views docs.
We can't provide a default search view out of the box, because of the entities being Fielded, and not supplying fields on install, because the user has to map them- so we do not know what the fields are. We should probably create some docs on how to setup a view, but, for now, this just needs clarification.
Comment #5
camidoo commentedchanging this to a support request / documentations & needs work. The OP has a valid point, however i honestly think that it is out of the scope of this particular module. However, i do agree that some documentation or a screen cast showing what is possible would go a long way in encouraging the use of this module if a potential user saw what was possible.
Comment #6
j9 commentedWhere does this code get inserted?
Excellent snippet and very useful! Thanks kevinquillen!
Comment #7
kevinquillen commentedIt really depends on your view, field types (text, int, number, etc) and field names. Just your standard form alter code. Handbook pages forthcoming.
Comment #8
kevinquillen commentedDocumentation has started. It can be accessed from the main project page under 'Read Documentation'. We're actively building out a series of handbook pages.
Comment #9
j9 commentedkevinquillen,
I am still wrapping my head around how to implement this.
I believe this is the code being used in the three showcase sites, yes?
This is exactly what I am looking to do to simplify the user selection of exposed view filters.
Do I put this code into a views textarea or somewhere in the Views admin ui?
I can adjust the form settings to match my filters, but do I put this code in a theme file or hack a views file?
I am building www.charlottesvillerealestate.us and have the filters in place. I just dont know where to alter/insert your code so that my forms turn from text fields to dropdown menus.
Just not sure but it definitely is something that would help people use drealty!
Thanks very much for any further direction.
Comment #10
kevinquillen commentedj9, I started on the Views docs page:
http://drupal.org/node/1536884
Comment #11
j9 commentedAwesome! Thanks for putting up the docs!
Am I correct that I have to write my own custom module to implement the drop down menus?
Any way this might work its way into the drealty release, to make it easy for people who dont know how to code?
Thanks again, kevinquillen! I'll keep a watch on the page and try and figure out what to do.
Comment #12
kevinquillen commentedIts tricky right now because we allow people to name fields whatever they want, because they also have to be mapped into their vendors RETS system.
Comment #13
j9 commentedOkay, thanks kevinquillen,
I have moved my questions about implementing the dropdown menu search to the docs so we can focus on letting people (myself included :) get it implemented with ease. I still have not understood the process fully.
drealty Docs
Basic Searching with Views
http://drupal.org/node/1536884
Thanks always very much!
Comment #14
j9 commentedHi,
When it is said here: http://drupal.org/node/1536884
Does this mean we have to write our own custom drupal module? like one that goes in the sites/all/modules folder that works with drealty?
I am at a loss on how to implement the
Can anyone share how to implement these dropdown menus to a non-coder?
Thanks! Searching drealty w/ dropdowns is essential! Much appreciate any guidance. :0)
Comment #15
kevinquillen commentedYes, writing a form alter requires writing a custom module... its going to take code to adjust the output. Writing a module that does a form alter is possibly one of the easiest Drupal modules to cut your teeth on.
Start here:
http://drupal.org/node/1074362
http://drupal.org/node/1075072
http://drupal.org/node/1095546
You can run through those in about an hour or less.. then the search view tutorial might make more sense to you.
In the snippet above, once you have a hold on the 3 links above, replace 'your_custom_module' with the name of your module. You can then get the ID of the form on the view by typing:
var_dump($form['#id']);Immediately after the first brace in the form alter.
Comment #16
j9 commentedThanks kevinquillen!
I will try to write a module following your instructions and the drupal doc links you posted above.
If I am successful, I will add the steps to the dRealty Docs. Thanks again! :0)
Comment #17
j9 commentedHere is what I did and what happened:
I created folder drealty_dropdowns in sites/all/modules
I created file drealty_dropdowns.module inside the drealty_dropdowns folder.
drealty_dropdowns.module has this code (using my county field for a dropdown):
I created drealty_dropdowns.info in the drealty_dropdowns folder w/ this content:
I went to the modules page in drupal, saw dRealty Dropdowns as an optional module, enabled it, saved, and it went to admin/modules/list/confirm and had a blank page.
I went back to my view and nothing has changed.
Also, I note that when I reload the modules page in drupal, I see that dRealty Dropdowns is *not* checked.
Am I anywhere close? Thanks very much!
Comment #18
j9 commentedOkay, I turned on error reporting and see this on the white page when I try to enable the module:
Fatal error: Cannot redeclare drealty_dropdowns_form_alter() (previously declared in /var/www/vhosts/fly7/sites/all/modules/drealty_dropdowns/drealty_dropdowns.module:2) in /var/www/vhosts/fly7/sites/all/modules/drealty_dropdowns/drealty_dropdowns.module on line 25Thanks for any pointer or bit of help.
Comment #19
j9 commentedOkay, realized I had posted code twice in the same module.
Here is my module code now (successfully enabled, but not showing up in my view).
Comment #20
jday commentedTry using 'views_exposed_form' for the form id, and the #id to target this specific exposed view like this (the name of my view is 'property-search' and I'm building a page view):
Comment #22
kevinquillen commentedYes, your form id looks a bit off, but you should be close.
Welcome to the world of one of the most useful/powerful Drupal hooks, hook_form_alter.
If you want your $form['#id'] simply do var_dump($form['#id']); right after declaring the form alter. Then visit a page with the search form on it.
You can also influence the name of the view ID with the 'machine_name' property on the View configuration. You can find that in the bottom right area of the options (under 'Advanced').
You could also enable Devel module and use the function krumo() in place of var_dump. It will be a much nicer debug output.
Example: krumo($form);
This would show you whats inside the form array, so, for example, at the end of your form alter code, krumo($form). You could quickly see if any of your code affected the form array.
Comment #23
j9 commentedI had the incorrect views form id.
With the following code, I was able to see a dropdown menu! :0)
See attached image for its display.
Cool! Getting somewhere fast! :D
Comment #24
j9 commentedCorrected screenshot -- see attached.
Comment #25
j9 commentedNext logical question for dRealty views search form alterers would be, how do we make the form select dropdown menu display only the values we want to display?
Instead of all the counties provided by the rets server, we might just want 5 counties out of the lot.
Does anyone have a template for doing this?
Cool thanks! :0)
Comment #26
kevinquillen commentedInstead of querying for counties, just fill the array yourself:
Comment #27
j9 commentedSuper thanks kevinquillen!
I'll try that out. Big thanks! :D
Comment #29
droddis commentedI assume I can use this same format for the bedrooms search if I want to display 1+ bedrooms etc. Would I need to add anything in order to have it show all properties with more then 1 bedroom as opposed to only those with 1 bedroom?
As an example:
$bedrooms_options['1'] = '1+ Bedrooms';
$bedrooms_options['2'] = '2+ Bedrooms';
$bedrooms_options['3'] = '3+ Bedrooms';
$bedrooms_options['4'] = '4+ Bedrooms';
$bedrooms_options['5'] = '5+ Bedrooms';
$bedrooms_options['6'] = '6+ Bedrooms';
If I use these options then I get only those properties with the specified number of bedrooms as opposed to all those with the specified number and above.
Also using this code I notice that some values are overwritten by the raw database value. Any suggestions?
Comment #30
kevinquillen commentedTo show greater than or equal to, change the filter to be that instead of equals.
Comment #31
droddis commentedfacepalm...... thanks Kevin.
By the way the module is working out very well. Really appreciate all the help these forums have provided. I'm not sure I can help with any documentation but if I can I would be happy to help. Point me in the direction of something basic that needs done and I'll do my best!
Comment #32
droddis commentedOk I may be due for another face/palm but I can't for the life of me figure out where I change the = sign to a greater than sign. I've tried all manner of combinations but I obviously don't understand the language well enough to get it to work.
Any further suggestions on where to look?
Comment #33
droddis commentedOk the last comment on this I promise. I had the Bedrooms configured as a text field as opposed to an integer, meaning the Greater then option wasn't available.