AdvSearch noob question.
I've got AdvSearch running fine with an 'off the shelf' search via input field, returning results fine in the standard format. It's running in Revolution 2.5.5-pl, via MAMP on MacOS 10.12.4, PHP 5.5.10, MySQL 5.5.34. I have Zend lib 1.2 installed in what I think is the required location.
I need to integrate search filtering to return a range of resources based on TVs. I built a custom form and queryHook for this following the guides in the AdvSearch download docs:
advSearch101_v1.0.pdf and
advsearchHook120_v1.0.pdf. But currently what I've built isn't returning anything from the custom form searches, either filtered or unfiltered.
I need my search to return a range of properties based on:
Location,
Sleeps (amount),
Bedrooms (amount).
I've set up some TVs - [[*Location]] [[*Sleeps]] [[*Bedrooms]] - and 4 Resources are using them. The TVs are each Listboxes (Single select), with appropriate Input Option numeric or text values, and are
not set to Allow Blank. They all work fine as they render elsewhere via hard-coded references in the page template.
So here's what I've built so far to get this Search running - apologies for non-indented/highlighted code:
Snippet calls:
[[!AdvSearchForm? &tpl=`filter2SearchForm` ]]
Results:
[[!AdvSearch? &queryHook=`Filter2QHook` &includeTVs=`Location, Sleeps, Bedrooms` &withFields=`introtext,description,content` ]]
Search form (filter2SearchForm):
<form class="advsea-search-form" action="[[~[[+landing]]]]" method="[[+method]]">
<fieldset>
<input type="hidden" name="id" value="[[+landing]]" />
<input type="hidden" name="asId" value="[[+asId]]" />
<label>Select a Location:
<select name="ctgLoc" >
<option value="all" selected="selected">-All Locations -</option>
<option>North</option>
<option>East</option>
<option>South</option>
<option>West</option>
</select>
</label>
<label>Bedrooms:
<select name="ctgBed">
<option value="all" selected="selected">Any</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5+</option>
</select>
</label>
<label>Sleeps:
<select name="ctgSle">
<option value="all" selected="selected">Any</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8+</option>
</select>
</label>
<input type="submit" name="sub" value="[[%advsearch.search? &namespace=`advsearch` &topic=`default`]]" />
</fieldset>
</form>
[[+resultsWindow]]
queryHook (Filter2QHook):
<?php
$andConditions = array(
'tv.Location:=' => 'ctgLoc:request:all',
'tv.Bedrooms:=' => 'ctgBed:request:all',
'tv.Sleeps:=' => 'ctgSle:request:all',
);
$qhDeclaration = array(
'qhVersion' => '2.0.0-beta2'
'andConditions' => $andConditions
);
$hook->setQueryHook($qhDeclaration);
return true;
In the queryHook you'll see that I used
'qhVersion' => '2.0.0-beta2' as that's the version of AdvSearch.
At this point I'm getting no results at all from this. Can anyone let me know if there's any glaring omission and/or error here?
Any help/advice would be much appreciated.
Thanks in advance.
[ed. note: powellian last edited this post 7 years, 4 months ago.]