OS Property support center

Order by Price?

More
11 years 11 months ago #31875 by Adam
Order by Price? was created by Adam
My customer would like to have properties ordered by price and was wondering if I could get the code or steps to add that into the possibilites for listings? Thanks!

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31878 by Mr. Dam
Replied by Mr. Dam on topic Re: Order by Price?
Hi,
You can modify the source code to get the properties order by price. Please follow these steps.
1. Open file :
components > com_osproperty > classes > listing.php
2. find php function : listProperties
3. find
if($orderby == ""){
$orderby = "a.id";
}
and change to

if($orderby == ""){
$orderby = "a.price";
}

Thanks
Dam

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #31993 by Adam
Replied by Adam on topic Re: Order by Price?
Thanks for the quick reply. I looked through the file and couldn't find anything matching the code you mentioned. Thanks again!

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #32003 by Mr. Dam
Replied by Mr. Dam on topic Re: Order by Price?
Hi Adam,
Please send your site information with super admin account, ftp account to : damdt@joomservices.com. i will help you to change it.
Thanks
Dam

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #32887 by Tony Cline
Replied by Tony Cline on topic Re: Order by Price?
Hi Dam,
I have changed the code as you have suggested but when using a menu type: OS Property » Layout: Property listing layout it does not make a difference. Is there something else that I need to do? It appears that it is still sorting by what the menu sort is selected to. My only options are
"Order properties by Hits" or Order properties by Latest". I want to order all of my property lists by Descending Price.

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #33882 by Anatoly
Replied by Anatoly on topic Re: Order by Price?

Tony Cline wrote: Hi Dam,
I have changed the code as you have suggested but when using a menu type: OS Property » Layout: Property listing layout it does not make a difference. Is there something else that I need to do? It appears that it is still sorting by what the menu sort is selected to. My only options are
"Order properties by Hits" or Order properties by Latest". I want to order all of my property lists by Descending Price.


Any solution for this?

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #33883 by Mr. Dam
Replied by Mr. Dam on topic Re: Order by Price?
Hi all,
In version 2.1.0, in the property listing layout, we add the price ordering. You can use that feature.
Thanks
Dam

Please Log in or Create an account to join the conversation.

More
11 years 5 months ago #39175 by Frédéric Boudet
Replied by Frédéric Boudet on topic Re: Order by Price?
The good code in listing.php is :
Code:
$query .= " and a.published = '1' and a.approved = '1'"; if($orderby == ""){ $orderby = "a.price"; } $query .= " ORDER BY a.price asc, $orderby $ordertype";

ABB

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago #85804 by Hamlet Kraskian
Replied by Hamlet Kraskian on topic Order by Price?
You have to change following also
in components/com_osproperty/classes /listing.php
if(!in_array($orderby, $orderbyArray)){
// $orderby = "a.id";
$orderby = "a.price" ;
$ordertype = "desc";
}
The following user(s) said Thank You: Mr. Dam

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamNguyen Phu Quan