We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    I am working on a small real estate site and puzzled about how best to handle Active Homes and Sold Homes. I have top level menu items for each that currently pull in TV values from the associated resources.

    pdoResources for Active homes pull in TV values from all resources in the ActiveHomes container.

    For the solds, I created a container for SoldHomes, and set up pdoResource to grab and display items from those resource.

    Moving forward, as homes sell, my thought was to simply change the parent container for an active home from ActiveHomes to SoldHomes.

    But I wonder: Is that a good approach to handle it? What if I were to create a checkbox TV call STATUS, with "active" || "sold" as the options. I'd just put all reources in one global directory called PROPERTIES. Can pdoResources, be set up to grab resources with STATUS value of "active" and STATUS value of "sold"?

    Now that I've typed this though, I realize that my top level menu is built on the fact that there are two containers — ActiveHomes and SoldHomes.

    So maybe trying to implement some kind of feature with pdoResource is not such a great idea? Maybe I should stick with my current approach?

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can use a TV to filter pdoResources. That's the way I would have done it.

      However, you can change a resource's parent easily enough. You can simply drag it into a different parent in the Resource Tree. You can manually or in a snippet or plugin change the value of the "parent" - it's just a field in the database, after all. You would need to make sure that your pdoResources snippet call was uncached, though, or else clear the cache in your code when you change something.

      See http://bobsguides.com/revolution-objects.html and http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/caching
        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
        • 46886
        • 1,154 Posts
        The tv approach seems cleaner, if you don't care about being able to see which resources are which in the resource tree. You could have 90% sold and only 10% active and the tree wouldn't give you this info.

        For top level menu, I think pdoResources can get your Sold and Active data according to this tv as well. Its an efficient solution.
          • 19872
          • 1,078 Posts
          Thanks for the responses. I think in the end for now, changing the parent wins out. Forgot about how many might appear all in one tree. I think I prefer having a visual of which are active and which are sold.

          I think I will stick with just changing the name and the parent in the resource manager for now.