We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21884
    • 57 Posts
    I’m working on a Real Estate Site, one of the requirements being a search function for individual properties that are stored, search options being location, number of beds, price-range etc...

    My idea was to setup some TVs, most of which are drop-down options, and then when the client adds a new document (property) they can assign different values using the TVs i’ve associated.

    1st question is this, would this even work? Is it possible to have a search-form in the front-end and filter results based on TV values associated with those documents?

    2nd question, one of the "property" options is location. I need 2 options for the admin user, one is to select from a drop-down list of pre-existing locations, the other is to let the admin enter a new location.

    can i populate a tv drop-down list from values that have been assigned to a TV in documents? and if so, can i have an "either/or" TV where they either select from a list or enter a new value?

    thanks for any help!

    PS: Forgot to clarify that i’m using ModX Revolution RC2
      • 12379
      • 460 Posts
      Uh, I was gonna say for Evolution there’s AjaxSearch which can search tvs using the &withTvs parameter, but I’m not sure it’s compatible for Revolution.

      http://wiki.modxcms.com/index.php/AjaxSearch

      Guess that’s the risk with using Revolution before more plug-ins are available.
        Mostly harmless.
        • 26931
        • 2,314 Posts
        TVexplorer can do that http://modxcms.com/forums/index.php/topic,16456.0.html ...a simpler (not so feature rich, advanced) approach: http://bit.ly/bgx7dX ...and i think the current AjaxSearch version can do similar tasks, too
        oh, don’t know about Revo sad
          • 3749
          • 24,544 Posts
          You might be happier in the long run if the data for all the properties were stored in a custom DB table -- one record for each property. If there are a lot of properties, having a resource and many TVs for each one will create a lot of unnecessary overhead and be much slower.

          Once the table is created and you have a schema for it, you could use a front-end form to enter and search for properties. You might be able to do it with FormIt and a couple of custom hooks.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 21884
            • 57 Posts
            thanks for all the answers!

            for the search function:
            i was thinking to do a custom snippet, looking at the modx db tables, if i query for value on the modx_site_tmplvar_contentvalues table where tmplvarid = the id for the template variable in question that would give me the values of that tv and i could use that to populate a front-end search select box right?

            for the tv/populate function:
            i could do a similar query and that would give me a list of values for that tv, could i use that list to populate a tv choice?

            it would be fairly customized to my needs and not as customizable, but would those search options be too slow for a live site?
              • 3749
              • 24,544 Posts
              Just to clarify, in the scenario I suggested, there would be no TVs at all and likely only one or two documents. Instead, there would Just be data in the DB and forms to create, edit, delete, and display that data. Obviously this wouldn’t be worth doing unless there were a substantial number of properties.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Looks like an excellent opportunity to play with AJAX.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 21884
                  • 57 Posts
                  @BobRay, I hadn’t gotten that, it does sound like a good idea to work that way, though i’m not familiar enough with the admin interface to know if incorporating management of custom db tables is an option... would you have any idea if that is so?

                  @sotwell, sure does! i’ll probably use ajax on the search form in the frontend, though my client wants to keep things simple, so rather than showing all results first and updating those results based on the choices made, i’ll probably just load the results once the user clicks send, should be simple enough to use ajax for that, do you know if formit works with JSON as well as eform does?
                    • 3749
                    • 24,544 Posts
                    Quote from: Lance at Jun 15, 2010, 05:26 AM

                    @BobRay, I hadn’t gotten that, it does sound like a good idea to work that way, though i’m not familiar enough with the admin interface to know if incorporating management of custom db tables is an option... would you have any idea if that is so?

                    You can definitely create a component to handle that stuff in the Manager, though it’s a non-trivial job to say the least. I was thinking of doing it with forms in the front end which, IMO, would be much easier (though somewhat less secure).
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting