Correct code for sort Order
14 posts by 2 authors in: Forums > CMS Builder
Last Post: January 25, 2010 (RSS)
By kitka - January 15, 2010
I created a dropdwon field for "status" of a listing that being either "For Sale" or SOLD
Currently under Order by i have the listings displaying as
featured DESC,price+0
What would i need to add to the 'ORDER BY" LINE to get the "SOLD" listings as checked from the dropdown "status" field to be displayed last
on the results page OF THE SITE
Re: [kitka] Correct code for sort Order
By Chris - January 15, 2010
"For Sale" comes before "SOLD", alphabetically, so you can sort on that field first:
status,featured DESC,price+0
Does that help? Please let me know if you have any questions.
Chris
Re: [chris] Correct code for sort Order
By kitka - January 22, 2010
the client wants the lsitings to appear from Lowest price FIRST[/#000000] to highest down, then have the SOLDS appear last[/#ff0000]....
http://www.jodyandgeorge.com/index4.php
ANY IDEA WHAT THE CORRECT SYNTAX FOR THE SORT ORDER TO MAKE THIS HAPPEN WOULD BE?
The SOLD is an option from the dropdown field Status.....
The current sort order is as follows:
price+0,status,featured DESC[/#ff0000]
the dropdown list options under status are as follows:
For Sale
For Lease
For Lease or Sale
SOLD
Re: [kitka] Correct code for sort Order
By Chris - January 22, 2010 - edited: January 22, 2010
the client wants the lsitings to appear from Lowest price FIRST to highest down, then have the SOLDS appear last....
To accomplish this, first you'll need to sort on whether or not status = "SOLD" (false will come first, since false=0 and true=1), then sort on price:
status = "SOLD", price+0
I hope this helps. Please let me know if you have any questions.
Chris
Re: [chris] Correct code for sort Order
By kitka - January 22, 2010
What need to be added to the price to show the lowest number first...ie 34,000 before 123,000
Re: [kitka] Correct code for sort Order
By Chris - January 22, 2010
Oops, you'll want "price+0" in your order by clause, not "price". I've fixed my message above to have the correct order by clause.
Chris
Re: [kitka] Correct code for sort Order
By kitka - January 22, 2010
Prices still not in order from lowest up[/#000000]
http://www.jodyandgeorge.com/index4.php[/#000000]
Re: [kitka] Correct code for sort Order
By kitka - January 22, 2010
If wonder if it si has to do wiht the code on the top of the list.php>
It is presently like this:
?php
require_once "init.php";
list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages',
'perPage' => '4',
list($homepageRecords, $homepageListDetails) = getRecords(array(
'tableName' => 'homepages')
)
));
?>
Does the sort order have to appear in there somerwhere?
Re: [kitka] Correct code for sort Order
By kitka - January 23, 2010
status="SOLD", price+0
It produced the solds last but the sort ordr is also now showing the rest ofd the listing as per how i entered them orginally in the admin area<
not by ascending price down...
http://www,jodyandgeorge.com/index4.php
Here a link to the admin area page that explains what is happening
http://www.jodyandgeorge.com/problemjan24.JPG
Notice the order on the index4 page and the admin page listing order...You'll see what i mean.