We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49542
    • 2 Posts
    Can getResources to skip children when the parent is unpublished without having to unpublish every single child resource?

    I think because of how I am calling getResources it is disregarding the parent completely as I need to access content 2 levels down. So I wonder if my logic is flawed to achieve this.

    I am using getResources and getPage to output content from my entire site tree (essentially a product catalogue).

    My resources looks like this:

    Parent
    Child (Published)
    Content I want
    Content I want
    Child (Unpublished)
    This is published, but I don't want it output
    Parent 2 (Published)
    Child (Published)
    Content I want
    Content I want
    ..

    GetResources is retrieving my records but it is ignoring the published status of the child's parent. Each parent has quite a lot of content, so I really don't want to "unpublish" each child.

    My snippet call is:

    [[!getPage?
    &elementClass=`modSnippet`
    &element=`getResources`
    &parents=`2,3,4,5` // the master "categories"
    &depth=`2` // I don't want the direct children, I want the children's children
    &limit=`12`
    &pageVarKey=`page`
    &includeTVs=`1`
    &includeContent=`0`
    &tpl=`MyTPL`
    ]]

    Hope this makes sense. Thanks.
      • 42562
      • 1,145 Posts
      Hello there, have you considered somethings supposedly more efficient and more customizable?

      Query
      http://modx.com/extras/package/query

      and

      Pdotools
      http://modx.com/extras/package/pdotools
      http://docs.modx.pro/en/components/pdotools/general-settings
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.