Ive been reading for 2 days the dozens of threads using filters and all sorts but all i want to do is have a drop down list on my front end which effectively changes the order by field so i can then sort results in however way I choose.
What i have done so far
Chunk
<form action="[~[*id*]~]" method="post">
<select name="sort">
<option value="pricelow">Price Cheapest First</option>
<option value="pricehigh">Price Most Expensive</option>
<option value="starhigh">Star Rating High</option>
<option value="starlow">Star Rating Low</option>
<option value="title">A-Z</option>
<option value="new">Newest First</option>
</select>
<input name="Submit" type="submit" value="Sort" />
</form>
[!hotel-list!]
hotel-list Snippet
<?php
global $modx;
$order = "price ASC";
if (!empty($_POST['pricelow'])) $order .= (empty($order)?"":"|")."tvprice,".mysql_escape_string($_POST['price ASC']).",1";
if (!empty($_POST['pricehigh'])) $order .= (empty($order)?"":"|")."tvprice,".mysql_escape_string($_POST['price DESC']).",1";
if (!empty($_POST['starhigh'])) $order .= (empty($order)?"":"|")."tvstar-rating,".mysql_escape_string($_POST['star-rating ASC']).",1";
if (!empty($_POST['starlow'])) $order .= (empty($order)?"":"|")."tvstar-rating,".mysql_escape_string($_POST['star-rating DESC']).",1";
if (!empty($_POST['title'])) $order .= "menuindex";
if (!empty($_POST['new'])) $order .= "createdon";
return $modx->runSnippet('Ditto', array('parents'=>'8', 'tpl'=>'hotel_summary', 'orderBy'=>$order, 'summarize'=>'55', 'display'=>'10', 'paginateAlwaysShowLinks'=>'1', 'paginate'=>'1', 'noResults'=>'no results'));
?>
?>
No working
Can you see what im trying to do? just change the order parameter based on a drop down selection.
Anyone able to help ?