We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38004
    • 96 Posts
    Hi,

    I'm having a big issue with get resources not showing any output.

    I have a container call products (id20). Inside this i have another container called product-type (id21).

    Inside this continer I have my products, each as a separate document. e.g Product A (id22), Product B (id23)

    Here is my getResources call that appears on my 'product-type' page:

    [[!getResources? &parents=`[[*id]]` &tpl=`product_list` &includeTVs=`1` &processTVs=`1`  &showHidden=`true`]]


    Here is my chunk:

    <div class="productlist">
    
    [[*product_image]]
    
      <h2><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></h2>
     
      
      <p class="summary">[[+introtext]]</p>
      <p class="readmore"><a href="[[~[[+id]]]]"><span>Read more</span></a></p>
     
      <div class="clear"></div>
    </div>
    <hr/>


    For some reason getRources just won't show anything unless I manually add in all the individual resources by hand e.g.
    &resources=`22,23,24,25,26`
    Which of course isn't what I want. I want all the resources under the parent 'product-type' to be shown.

    Can anyone help please?
      • 19369
      • 1,098 Posts
      Where is your getResources call? On a template, a chunk, or inside the main content of the resource?
        • 38004
        • 96 Posts
        In the resource content box with rich text turned off.

        The exact same call works in the resource container above this one. That is, in the products container, it will list the product-type resource, but placed in the product-type resource container, nothing shows.


        Store (container)
        -> Products (container)
        -->Product-type (container)
        --->Product A (single page)
        --->Product B (single page)
          • 19369
          • 1,098 Posts
          Can you try to place it in a chunk inside a template, and see if it works?
            • 38004
            • 96 Posts
            Just gave that a try, still no luck.

            The container using the getResources command


            [[!getResources? &parents=`[[*id]]` &tpl=`product_list` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` &showHidden=`true` ]]


            Will only show output when
            &resources=`22,23,24`
            Is added.

            I plan to have a lot of pages under this resource container, so would hate to have to list them all.

            Note that my resource container uses my default template. My resources that I want to show use my product template. I don't know if that makes any difference.
              • 19369
              • 1,098 Posts
              Sorry I don't understand why it is not working, the call seems ok. Have you tried it cached?
                • 38004
                • 96 Posts
                Both cached and uncached.

                I have pretty much the same code on another container working just fine.

                Could it be because this container is nested inside two other containers? Is that too deep for getResources to work?

                All of my containers, and pages, are 'hide from menu' and 'unpublished'

                I did try publishing, but it didn't make a difference and as this is a live site, i need them unpublished until working correctly
                  • 19369
                  • 1,098 Posts
                  Quote from: x0149128 at Apr 26, 2012, 12:24 PM
                  Both cached and uncached.

                  I have pretty much the same code on another container working just fine.

                  Could it be because this container is nested inside two other containers? Is that too deep for getResources to work?

                  No, this is not the reason, getResources can show content from any level of depth.

                  Quote from: x0149128 at Apr 26, 2012, 12:24 PM

                  All of my containers, and pages, are 'hide from menu' and 'unpublished'

                  I did try publishing, but it didn't make a difference and as this is a live site, i need them unpublished until working correctly


                  By default, getResources doesn't show unpublished resources. You need to add this parameter &showUnpublished=`1`

                  Also, I have noticed that you're using &showHidden=`true`. Can you try with &showHidden=`1` instead?

                  [[!getResources? &parents=`[[*id]]` &tpl=`product_list` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` &showHidden=`1` &showUnpublished=`1`]]

                    • 38004
                    • 96 Posts
                    That works. Thanks.