<select name="pricerange" class="selecter"> <option selected="selected" value="all">Select a price range</option> <option value="all">Any</option> <option>0-500,000€</option> <option>500,000-1,000,000€</option> <option>1,000,000-1,500,000€</option> <option>1,500,000-2,000,000€</option> <option>>2,000,000€</option> </select>
/** * AdvSearch * * Copyright 2012 by Coroico <[email protected]> * * QueryHook for Faceted search demo 1 * */ $andConditions = array( 'tv.property-type:=' => 'type:request:all', 'tv.property-number-bedrooms:=' => 'bedrooms:request:all', 'tv.property-location:=' => 'location:request:all' ); $requests = array(); // price $tag = 'pricerange'; $pricerange = strip_tags($_GET[$tag]); if (!empty($pricerange)) { $vpricerange = substr($pricerange,0,-1); // to clear the money unit if ($vpricerange == '>2,000,000') { $andConditions['tv.property-price:>'] = '2,000,000:numfield'; } else { list($pinf,$psup) = explode('-',$vpricerange); $andConditions['tv.property-price:>='] = $pinf.':numfield'; $andConditions['tv.property-price:<='] = $psup.':numfield'; } // propagate the http request variable for pagination $requests['pricerange'] = $pricerange; }; $qhDeclaration = array( 'qhVersion' => '1.2', 'andConditions' => $andConditions, 'requests' => $requests ); $hook->setQueryHook($qhDeclaration); return true;
This question has been answered by howster. See the first response.
<select style="width: 88px;" name="minp"> <option value="none" selected="selected">Min Price</option> <option value="750000">€750,000</option> <option value="1250000">€1,250,000</option> <option value="2250000">€2,250,000</option> <option value="3250000">€3,250,000</option> <option value="5000000">€5,000,000</option> <option value="10000000">€10,000,000</option> <option value="20000000">€20,000,000</option> </select></td> <td><select style="width: 88px;" name="maxp"> <option value="none" selected="selected">Max Price</option> <option value="1250000">€1,250,000</option> <option value="2250000">€2,250,000</option> <option value="3250000">€3,250,000</option> <option value="5000000">€5,000,000</option> <option value="10000000">€10,000,000</option> <option value="20000000">€20,000,000</option> <option value="30000000">€30,000,000</option> </select>
<?php /** * AdvSearch * * Copyright 2012 by Coroico <[email protected]> * * QueryHook for Faceted search demo 2 * */ $andConditions = array( 'tv.property_type:=' => 'property_type:request:all', 'tv.bedrooms:>=' => 'minb:request:none', 'tv.bedrooms:<=' => 'maxb:request:none', 'tv.property_price:>=' => 'minp:request:none', 'tv.property_price:<=' => 'maxp:request:none', 'tv.property_area:<=' => 'area:request:none' ); $qhDeclaration = array( 'qhVersion' => '1.2', 'sortby' => 'sort', 'perPage' => 'ppage', 'andConditions' => $andConditions ); $hook->setQueryHook($qhDeclaration); return true;