We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41055
    • 24 Posts
    Hi, I am fairly new to Modx and I after many hours of research, I am stumped. I am trying to display a gallery driven by a TV in an Advsearch result.

    I have set up a gallery, created a tv and assigned it to a template then populated that gallery via the template properties. I can call that gallery using the following anywhere:

    [[!Gallery? &album=`[[*tv_gallery]]` &plugin=`slimbox`  &slimboxLoadJQuery=`1` &loop=`1` &thumbWidth=`170` &thumbHeight=`170`]]


    and it works wonderfully. However, if I try to call the same within the chunk I use for my results in Advsearch, it does't work. I have tried with

    [[!Gallery? &album=`[[+tv_gallery]]` &plugin=`slimbox`  &slimboxLoadJQuery=`1` &loop=`1` &thumbWidth=`170` &thumbHeight=`170`]]

    and
    [[!Gallery? &album=`[[+tv.tv_gallery]]` &plugin=`slimbox`  &slimboxLoadJQuery=`1` &loop=`1` &thumbWidth=`170` &thumbHeight=`170`]]


    without any luck. If i try simply calling my gallery directly by using &album=`my_gallery`, it works perfectly fine. What am I missing?

    Thanks!
      • 5811
      • 1,717 Posts
      [[!Gallery? &album=`[[+tv.tv_gallery]]` &plugin=`slimbox`  &slimboxLoadJQuery=`1` &loop=`1` &thumbWidth=`170` &thumbHeight=`170`]]
      This should work. I did a quick test without problems.

      Could you give us your advSearch snippet call ?

      To work you need to have something like this:
      [[!AdvSearch? &withTVs=`tv_gallery` &tpl=`withGalleryResult` ]]

      You could test that you correctly get the tv value by adding:
      <div><span>Gallery name:</span> [[+tv_gallery]]</div>
      inside the withGalleryResult chunk.
        • 41055
        • 24 Posts
        I didn't have the tpl for withGalleryResult but now that I do, this is the result:
        http://primergrey.net/MMD/3/index.php?id=2&asId=as0&typer=all&ctg=all&subn=all&bed=2&minf=&msup=&sub=Search

        Before, it would break before the document was even loaded, because it didn't find the gallery at all.

        This is what I have on right now in my snippet call, using [[+tv.tv_gallery]]:
        [[!AdvSearchForm? &tpl=`chunk.1SearchForm`]] 
        <h3 class="results">Results are in</h3>
        [[!AdvSearch? 
        &perPage=`3` 
        &pagingType=`2` 
        &queryHook=`filter1qhook` 
        &withTVs=` sub_owner, tv_sub_neighborhood,tv_property_type,tv_sub_bed,tv_sub_rent,tv_gallery` 
        &includeTVs=`tv_property_image,tv_property_street,tv_property_address,tv_manager_tel,tv_property_description`
        &tpl=`withGalleryResult`
         ]]
        


        Am missing the chunk for withGalleryResult?

        Also, I have tried to call the tv directly in my search result and nothing shows. Which is strange, because calling that directly on any associated page works properly. [ed. note: helene last edited this post 14 years ago.]
          • 4619
          • 23 Posts
          Am missing the chunk for withGalleryResult?
          No, a new chunk for the result template is not mandatory. But, if you don't use a new chunk, you need to modify the default advSearchResult chunk.

          Also, I have tried to call the tv directly in my search result and nothing shows. Which is strange, because calling that directly on any associated page works properly.

          Could you also try to add tv_gallery inside the &includeTvs parameter:
          &includeTVs=`tv_property_image,tv_property_street,tv_property_address,tv_manager_tel,tv_property_description, tv_gallery`
            • 41055
            • 24 Posts
            It worked!
            The problem was in the fact that some results it returned results for children, which didn't have the gallery, so on my last round of testing, it didn't return an error but didn't display the gallery either.

            Adding to the &includeTV did the trick but if I use withGalleryResult, it breaks. I guess I can live without it.

            Now I just have to limit search to the right element so it will not return a blank result.

            Thanks for all the help!
              • 41055
              • 24 Posts
              Hey, kinda re-opening this one, I must be stupid and not missed a key concept here.

              I've been able to list the gallery, and to list the children of my resources but not the parent's TVs for some reason. I can display only the lower level information in my search results. I have enabled and disabled hideContainers to no avail. Is it possible to display two levels on one search result? I had a case where I displayed the parent as a result but the TV for it weren't populated. I made sure they were called in the &includeTVs as well as &withTVs, and I am calling the tvs as follow
              [[+tv_manager_tel]]
              


              That will not work for the parent, but the same for the child works:
              [[+tv_sub_unit_name]]


              Help would be greatly appreciated!