We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • discuss.answer
    • 17301
    • 932 Posts
    Advsearch would be what you're looking for.
      ■ email: [email protected] | ■ website: https://alienbuild.uk

      The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
      • 54139
      • 3 Posts
      Quote from: lkfranklin at Mar 26, 2018, 05:28 PM
      Advsearch would be what you're looking for.

      How can I use it to do a multicriteria search with button checkbox or radio button?
      Thank you for answering me because I really need it for a project
        • 17301
        • 932 Posts
        Here's a simple example to get you started. But essentially it's like formit in that you grab the names of the input fields and then insert them into your queryhook. So in this example below we've created an advanced search that will filter results by location. The location is coming from a dropdown select.

        The search form (change to your own search results landing page id:

        [[!AdvSearchForm? &landing=`91` &tpl=`jobSearchForm`]] 


        The chunk called 'jobSearchForm':

        <form class="advsea-search-form box search" action="[[~[[+advsearch.landing]]]]" method="[[+advsearch.method]]"> 
        	<input type="hidden" name="id" value="[[+advsearch.landing]]" />   
        	<input type="hidden" name="asId" value="[[+advsearch.asId]]" /> 
        
        	<div class="title">Job Finder</div>
        	<input type="text" id="[[+advsearch.asId]]_search" name="[[+advsearch.searchIndex]]" value="[[+advsearch.searchValue]]" placeholder="Search Term"> 
        
        	<select name="location" id="search">
        		<option selected disabled>Location</option>
        		<option>Option 1</option>
        		<option>Option 2</option>
        		<option>Option 3</option>
        		<option>Option 4</option>
        		<option>Option 5</option>
        	</select>
        
        
        	<input type="submit" name="sub" value="[[%advsearch.search? &namespace=`advsearch` &topic=`default`]]"> 
        
        </form>


        The snippet called 'filterJobsHook'. This is also where you add in your additional tv value arrays.

        <?php
        $andConditions = array(
        	'tv.location:=' => 'location'
        	);
        
        $qhDeclaration = array(
        	'qhVersion' => '1.2',
        	'andConditions' => $andConditions
        	);
        
        $hook->setQueryHook($qhDeclaration);
        return true;


        The search results page which will filter the results.

        [[!AdvSearch? 
        	&queryHook=`filterJobsHook` 
        	&includeTVs=`location` 
        	&showExtract=`2:content,location` 
        	&withTVs=`location` 
        	&fields=`pagetitle,introtext,publishedon,longtitle,unpub_date,content`
        ]]
        


        There should be some documentation available for anything additional located in the components folder if I recall.

          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.