We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29528
    • 10 Posts
    I am trying to have AjaxSearch display thumbnails from MaxiGallery on the results page.
    I have read some of the other posts on this forum about this issue, but I can’t seem to get it working.

    I will post my code, and if someone could post the code I need to use to replace mine, I would appreciate it very much.

    The code in the header chuck on my site:
    [!AjaxSearch? &ajaxSearch=`0` &AS_showResults=`0` &AS_landing=`8`!]
    



    The code on my results page:
    [!AjaxSearch? &ajaxSearch=`0` &AS_showResults=`1` &AS_showForm=`0`!]


    The site is a new project, so formatting isn’t a big deal at this time.
    My galleries are being searched now, but the results are just links to the parent gallery.

    Thanks!
      • 5811
      • 1,717 Posts

      Look at this demo on the ajaxSearch demo site : http://www.modx.wangba.fr/index.php?id=327

      Search for instance Peterhof
      This demo runs with the ajaxSearch mode, but this is the same thing with the non-ajax mode (&ajaxSearch=`0`)

      Header:
      [!AjaxSearch? &ajaxSearch=`0` &AS_showResults=`0` &whereSearch=`content:null|maxigallery` &AS_landing=`8`!]


      With this snippet call you search in the maxigallery tables
      &whereSearch=`content:null|maxigallery` is required to search in maxigallery and not in content or tv

      Landing page:
      [!AjaxSearch? &ajaxSearch=`0` &tplResult=`withMaxigalleryResult` &AS_showForm=`0`!]


      &AS_showResults=`1` is useless (set by default)

      Set up a chunk withMaxigalleryResult with the following content:
      <div class="[+as.resultClass+]">
        <a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
      [+as.descriptionShow:is=`1`:then=`
        <span class="[+as.descriptionClass+]">[+as.description+]</span>
      `+]
      [+as.gal_idShow:is=`1`:then=`
        <br />[!MaxiGallery? &pic_query_ids=`[+as.gal_id+]` &galleryPictureTpl=`subSearchGalleryPictureTpl`!] 
      `+]<br />
      [+as.extractShow:is=`1`:then=`
        <div class="[+as.extractClass+]"><p>[+as.extract+]</p></div>
      `+]
      [+as.breadcrumbsShow:is=`1`:then=`
        <span class="[+as.breadcrumbsClass+]">[+as.breadcrumbs+]</span>
      `+]
      </div>

      The key of this chunk is:
      [+as.gal_idShow:is=`1`:then=`
      [!MaxiGallery? &pic_query_ids=`[+as.gal_id+]` &galleryPictureTpl=`subSearchGalleryPictureTpl`!] 
      `+]
      You could set up your galleryPictureTpl as you like

        • 29528
        • 10 Posts
        Thank you for your reply.
        I followed your instructions step-by-step (to the best of my ability), but still cannot get the thumbnails to display in the results.

        Unless the galleryPictureTpl is something I need to setup other than what is in the /assets/snippets/maxigallery/templates folder, I have left it as default.
        I do not understand what the subSearchGalleryPictureTpl is, or where it is supposed to be located. I do not have that file anywhere that I can find.

        Thanks again you for your help so far.

          • 5811
          • 1,717 Posts
          Hereafter is the template subSearchGalleryPictureTpl used on the demo site. Not sure that this one is very different of the template from maxigallery

          This code have to be copied/pasted in a chunk (see elements tab in the manager)

          [+maxigallery.embedtype:is=`smoothgallery`:then=` 
          	<div class="imageElement">
          	<h3>[+maxigallery.picture.title:htmlent+]</h3>
          	<p>[+maxigallery.picture.descr:htmlent+]</p>
          	<a href="[+maxigallery.picture_link_url+]" title="[+maxigallery.strings.click_to_zoom+]" class="open"></a>
          	<img src="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" class="full" />
          	<img src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" class="thumbnail" />
          	</div>
          `+]
          
          [+maxigallery.embedtype:isnot=`smoothgallery`:then=`
           
          <li>
          [+maxigallery.embedtype:is=`slidebox`:then=` 
          
          	<a href="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" rel="lightbox_[+maxigallery.path_to_gal+]gallery">
          
          `+]
          
          [+maxigallery.embedtype:is=`lightboxv2`:then=` 
          
          	<a href="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" rel="lightbox[maxigallery]" title="[+maxigallery.picture.title:htmlent+] - [+maxigallery.picture.descr:htmlent+]">
          
          `+]
          
          [+maxigallery.embedtype:is=`slimbox`:then=` 
          
          	<a href="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" rel="lightbox[maxigallery]" title="[+maxigallery.picture.title:htmlent+] - [+maxigallery.picture.descr:htmlent+]">
          
          `+]
          
          [+maxigallery.embedtype:is=`popup`:then=` 
          
          	<a href="javascript:void(0);" onClick="javascript:openWindow('[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]','[+maxigallery.picture.title:htmlent+]',[+maxigallery.picture_height_normal+],[+maxigallery.picture_width_normal+],'gallery');">
          
          `+]
          
          [+maxigallery.embedtype:is=`external`:then=` 
          
          	<a href="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" rel="external">
          
          `+]
          
          [+maxigallery.embedtype:is=``:then=`
          	
          	<a href="[+maxigallery.picture_link_url+]">
          
          `+]
          	
          	 	<img src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" height="[+maxigallery.picture_height_thumb+]" class="thumbnail" title="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" alt="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" />
          	
          	</a>
          	[+maxigallery.picture.title:isnot=``:then=`
          		<p style="width: [+maxigallery.picture_width_thumb+]px;">
          		[+maxigallery.picture.title:htmlent+]
          		</p>
          	`+]
          </li>
          `+]

            • 29528
            • 10 Posts
            Hmm.. I had the chunk created, but it still isn’t working.
            It seems like the person in this post was having the same issue: http://modxcms.com/forums/index.php?topic=39601.0

            The search results are displaying, but the thumbnails aren’t in the list.
              • 29528
              • 10 Posts
              Would it help if I sent you a link to the site via PM?
                • 5811
                • 1,717 Posts
                Yes could send me a link by PM. Send me the two snippets calls too.


                The search results are displaying, but the thumbnails aren't in the list.
                And you are sure that the search term is in the title of an image ?
                  • 29528
                  • 10 Posts
                  I guess I should have said, the links to the gallery are displaying rather than the results for individual photos. My mistake.

                  The photo names are: kf5t1669.jpg, ..etc, but the titles under ’Manage Pictures’ are Tortola-1 through Tortola-10.
                  PM on the way..

                    • 5811
                    • 1,717 Posts
                    Could you check that

                    1/ the page which contain the gallery is searchable (see the configuration tab of the document)

                    2/ in the landing page adds:
                    &whereSearch=`content:null|maxigallery`


                    I have quickly set up a demo with the non-ajax mode on this page: http://www.modx.wangba.fr/index.php?id=379
                    Try to search "peter". It works.

                      • 29528
                      • 10 Posts
                      Success! It worked.

                      It says, 1 result found, even though there are 9 or 10 photos listed smiley
                      It would be nice to eventually get that fixed, but getting the thumbnails displaying was a big step for today smiley

                      You rock!