We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22840
    • 1,572 Posts
    I've just installed getids via the package manager and tried the following in the search page:

    [[!AdvSearchForm? 
       &landing=`14` 
       &engine=`zend`
       &searchString=`Search Here....`
       &init=`all`  
       &ids=`[[!GetIds? &ids=`3`]]`
       &perPage=`5`
    ]]


    Id 3 has a child called accessories but when I search for accessories it still displays the same result

    Thanks for helping out
      • 33976 ☆ A M B ☆
      • 571 Posts
      Paulp, see http://rtfm.modx.com/display/ADDON/AdvSearch.AdvSearch

      The ids parameters needs to be in AdvSearch snippet call, not the form itself
        • 22840
        • 1,572 Posts
        Thanks romain,

        Still having problems with this sad

        I've now got the following call on the results page.

        [[!AdvSearch? &ids=`[[!GetIds? &ids=`1, c1`]]` &withFields=`introtext`]]


        Now if I search for accessories I get 1 resulr ( correct ) and accessories is 2 levels deep from id1, however if I search for CCTV I get no results but CCTV is only 1 level deep from ID1

        This is really a lot harder than it needs to be sad

        Thanks for the help
          • 33976 ☆ A M B ☆
          • 571 Posts
          If my understanding is good, the withFields parameter define the field(s) where to do the search. So does your CCTV resource contains "CCTV" in its introtext field ?

          Edit: i'm not sure it's written in the official documentation, but Coroico did an awesome & extensive documentation you can grab on his website… a must to read when you want to fine tune AdvSearch smiley
            • 22840
            • 1,572 Posts
            romain I owe you a big drink, thanks so much.

            Now have the following call and all working:

            [[!AdvSearch? &ids=`[[!GetIds? &ids=`1, c1`]]` &withFields=`introtext, pagetitle, content`]]


            Thanks
              • 33976 ☆ A M B ☆
              • 571 Posts
              Glad you got this beast working wink

              Cheers
                • 22673
                • 72 Posts
                I am using Advsearch successfully to search across 3 different dropdown list TVs and bring back results. I just wondered if it was possible to pull out the 3 options the user searches on, outside of the looping result tpl?

                Let me explain - the user selects 3 options from 3 different dropdown lists which have the same values as my 3 TVs. The search results are show on my landing page based on the 3 options selected by the user. But above these search results (in the "AdvSearchResults" / "containerTpl") I would like it to say: "You searched for: Option 1, Option 2, Option 3.

                Does anyone know how to do this?
                  • 5811
                  • 1,717 Posts
                  No, it doesn't exist, with the current release, a placeholder which display the selected options.
                  This is a good remark, and I will try to implement this feature for the 1.0.0 pl release.

                  Otherwise you could have a workaround as the options are available as http variables. For this create a snippet named for instance "GetSearchFilters" with the following content (not tested):

                  <?php
                  
                  $options = array('option1','option2','option3'); // initialise with the name of your options
                  $intro = "You searched for: ";
                  
                  $optionsSelected = array();
                  foreach($options as $opt) {
                  	if (isset($_REQUEST[$opt])) {
                  		if (is_array($_REQUEST[$opt])) {
                  			// mutiple select
                  			foreach($_REQUEST[$opt] as $s) $optionsSelected[] = strip_tags($s);       
                  		}
                  		else $optionsSelected[] = strip_tags($_REQUEST[$opt]); 
                  	}
                  }
                  if (count($optionsSelected)) $msg  = $intro . explode(", ",$optionsSelected);
                  if ($msg) echo $msg;

                  Replace option1,option2,option3 by the names of your http variables.

                  Then use the snippet inside a chunk (clone of advsearchresults) named for instance "mySearchResults"

                  <p class="advsea-results">[[+resultInfo]] - Elapsed time: [[+etime]]</p>
                  <p>[[!GetSearchFilters]]</p>
                  <div class="advsea-paging[[+pagingType]]">[[+paging]]</div>
                  <div class="advsea-results-list">
                      [[+results]]
                  </div>
                  <div class="advsea-paging[[+pagingType]]">[[+paging]]</div>

                  and then use this chunk inside the advsearch snippet call with the &containerTpl parameter:
                  &containerTpl=`mySearchResults`

                  Try it and let me know the results
                    • 22673
                    • 72 Posts
                    Hi coroico, thanks for the quick reply and the snippet!

                    I have followed your instructions but the output on the page is:

                    You searched for: Array
                      • 5811
                      • 1,717 Posts
                      too fast ...

                      Replace
                      if (count($optionsSelected)) $msg  = $intro . explode(", ",$optionsSelected);

                      by
                      if (count($optionsSelected)) $msg  = $intro . implode(", ",$optionsSelected);