 |

snaketorque
User
Sep 27, 2002, 1:24 PM
Post #1 of 4
(1800 views)
Shortcut
|
|
Sorting Listings
|
Can't Post
|
|
Hi This is probably a very easy question, but I cannot for the life of me work it out. I would like to display the AM listing newest first in the index page, any idea how I can do this. Thanks Robert
|
|
|  |
 |

Damon
Staff
/ Moderator

Sep 27, 2002, 4:45 PM
Post #2 of 4
(1788 views)
Shortcut
|
|
Re: [snaketorque] Sorting Listings
[In reply to]
|
Can't Post
|
|
Hi Robert, The listing index by default displays listings in alphabetical order based on the vehicle name. What you can do is link directly to the search results instead, and sort on one of the listings fields. Here’s an example of how to create a link that links directly to the search results of all of your listings sorted by price for example. (Backup your templates before modifying them so you can go back to them if needed). 1. Open up your _search_query.html page and add the following. (Make sure to add this somewhere between the open <form> and closing </form> tag. <input type="hidden" name="sort_order" value="3,123,forward"> (by default field 3 is the price field, so we enter in field 3 as the value. If you use something else you'll want to make the appropriate changes) The first part of the value ("3") is the field number to sort by,the second part is the type of sorting to do (abc for alphabetical,123 for numerical) and the third part is the direction to sort in. 2. Go to your search query page in your browser. (search.cgi) (Make sure your search results are outputting 10 listings per page, you can change this # by modifying the "results per page" field in your _search_query.html page RESULTS PER PAGE You can specify the results to be shown per page with the "perpage" field like so: <input type="hidden" name="perpage" value="10">) Perform a generic search (don't fill out any of the search fields, just click search.) All of the search results for all of you listings should be displayed. Copy and paste the search results URL from your browsers address bar. Replace this URL with the URL you normally use to link people to the HTML file listings index. You'll probably want to make this URL replacement in all 6 of your template files. 3. Now when people click on "view our listings" they'll be taken to the entire search results of all of your listings, displaying 10 listings per page, and sorting by price. I hope that helps. Let me know if you have any questions. Cheers Damon Edis interactivetools.com
|
|
|  |
 |

snaketorque
User
Sep 28, 2002, 3:34 AM
Post #3 of 4
(1778 views)
Shortcut
|
Damon I have put the following field into the search page, <input type="hidden" name="sort_order" value="8,123,forward"> as I want to sort on a unique ID field 8 however the search page still displays via some other sort mechanism. Search page at http://www.totalkitcar.com/cgi-bin/am/exec/search.cgi I have not as yet changed the fields on the search results, will this have a bearing on the output? Thanks Robert
|
|
|  |
 |

Damon
Staff
/ Moderator

Sep 30, 2002, 1:10 PM
Post #4 of 4
(1760 views)
Shortcut
|
|
Re: [snaketorque] Sorting Listings
[In reply to]
|
Can't Post
|
|
Hi Robert, I took a look at your search page and the source. Although you are sorting on listing field 8, it doesn't appear that you haven't added $lfield8$ to the _search_results.html template. By adding $lfield8$ to the search results template, you should be able to see the search results being sorting on that field. Give that a try and let me know if that works. Cheers Damon Edis interactivetools.com
|
|
|  |
|