Sorting custom fields
Posted Aug 23, 2013 - 1:46 PM:
I am going crazy trying to figure out how to sort some custom fields without having them stick after the user leaves the page and goes to a different page. I have a field that has three possible values that I want to sort by. Below is what I currently have, but it is sticking after the user goes back to the main website or anywhere else:
<IF {SWITCH_SORTLINKS} and {CATLINKSHERE}> <form action="index.php"> <input type="hidden" name="filter" value="TYPE95D32" /> <input type="hidden" name="action" value="displaycat" /> <input type="hidden" name="catid" value="{CATID}" /> <input type="hidden" name="linkfilteraction" value="add" /> Show <select name="perpage"> <option value="{PERPAGE}">{PERPAGE}</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50">50</option> </select> listings, ordered by <select name="filtervalue"> <option value=", Cars By Owner, ">Cars By Owner</option> <option value=", Cars By Dealer, ">Cars By Dealer</option> <option value=", Parts For Sale, ">Parts For Sale</option> </select> <select name="ascdesc"> <option value="ASC">ascending</option> <option value="DESC">descending</option> </select> <button type="submit" class="gobutton"><img src="{IMAGESURL}/sort.png" alt="" /> Sort</button> </form> </IF>
is serving no purpose in your current form because there are no fields being sorted, only filtered. You can add a sort option into the form with your filters if you want though as the example in the knowledge base does.
You should change the "ordered by" text to "filtered to" too so people understand they're filtering the view.
Comments on Sorting custom fields
Beginner
Usergroup: Customer
Joined: Aug 23, 2013
Total Topics: 1
Total Comments: 2
Posted Aug 23, 2013 - 1:46 PM:
I am going crazy trying to figure out how to sort some custom fields without having them stick after the user leaves the page and goes to a different page. I have a field that has three possible values that I want to sort by. Below is what I currently have, but it is sticking after the user goes back to the main website or anywhere else:
<IF {SWITCH_SORTLINKS} and {CATLINKSHERE}>
<form action="index.php">
<input type="hidden" name="filter" value="TYPE95D32" />
<input type="hidden" name="action" value="displaycat" />
<input type="hidden" name="catid" value="{CATID}" />
<input type="hidden" name="linkfilteraction" value="add" />
Show
<select name="perpage">
<option value="{PERPAGE}">{PERPAGE}</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
</select>
listings, ordered by
<select name="filtervalue">
<option value=", Cars By Owner, ">Cars By Owner</option>
<option value=", Cars By Dealer, ">Cars By Dealer</option>
<option value=", Parts For Sale, ">Parts For Sale</option>
</select>
<select name="ascdesc">
<option value="ASC">ascending</option>
<option value="DESC">descending</option>
</select>
<button type="submit" class="gobutton"><img src="{IMAGESURL}/sort.png" alt="" /> Sort</button>
</form>
</IF>
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
These are filters, not sorts. Unlike sorts, filters are sticky by default but there's an option for non-sticky filters at the bottom of scripts.webmastersite.net/w...ual/other/filters-201.html
If I'm reading my article right, to change your filters from sticky to non-sticky you'll want to change
to
and
to
To handle more fields, just increment the 0 index to 1, 2, etc.
Note that your is serving no purpose in your current form because there are no fields being sorted, only filtered. You can add a sort option into the form with your filters if you want though as the example in the knowledge base does.
You should change the "ordered by" text to "filtered to" too so people understand they're filtering the view.
Beginner
Usergroup: Customer
Joined: Aug 23, 2013
Total Topics: 1
Total Comments: 2
Thanks so much Paul! That worked perfectly!