- Posts: 5
COMMUNITY FORUM
Adding a secondary sorting criteria
- Yonatan Kra
-
Topic Author
- Offline
- New Member
Less
More
14 years 1 month ago #95256
by Yonatan Kra
Adding a secondary sorting criteria was created by Yonatan Kra
Hi,
I like this K2 component very much. It actually gives you anything you want.
What I'm looking for is this:
I sort my K2 articles by their number of hits.
I also want to sort them by rating, in case their number of hits is the same (AKA - secondary sorting).
Is this possible? If not, can you direct me where to "hack" in order to make it work?
Thanks :)
I like this K2 component very much. It actually gives you anything you want.
What I'm looking for is this:
I sort my K2 articles by their number of hits.
I also want to sort them by rating, in case their number of hits is the same (AKA - secondary sorting).
Is this possible? If not, can you direct me where to "hack" in order to make it work?
Thanks :)
Please Log in or Create an account to join the conversation.
- Yonatan Kra
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 5
14 years 1 month ago #95257
by Yonatan Kra
Replied by Yonatan Kra on topic Adding a secondary sorting criteria
Ok, I got it...
I hard coded it, but should be relatively easy to create a plugin or even add it to the component.
Great component. Keep it up.
I hard coded it, but should be relatively easy to create a plugin or even add it to the component.
Great component. Keep it up.
Please Log in or Create an account to join the conversation.
- swansonwc
-
- Offline
- New Member
Less
More
- Posts: 11
14 years 1 month ago #95258
by swansonwc
Replied by swansonwc on topic Adding a secondary sorting criteria
Yonatan,
My client asked for something similar yesterday. What's your site? Can I see what you've done?
Best regards,
Bill
Yonatan Kra said:
Ok, I got it...
I hard coded it, but should be relatively easy to create a plugin or even add it to the component.
Great component. Keep it up.
My client asked for something similar yesterday. What's your site? Can I see what you've done?
Best regards,
Bill
Yonatan Kra said:
Ok, I got it...
I hard coded it, but should be relatively easy to create a plugin or even add it to the component.
Great component. Keep it up.
Please Log in or Create an account to join the conversation.
- Yonatan Kra
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 5
14 years 1 month ago #95259
by Yonatan Kra
Replied by Yonatan Kra on topic Adding a secondary sorting criteria
Hi,
This is a web directory I used K2 to build.
The client wanted to sort according to the Bids (i.e. how much a person pays for the link) and if the bids are the same, they will be sorted by users rating.
You can have a look here: munexus.com
A category this comes into effect is this: munexus.com/internet.html
I didn't create a plugin or anything - I just edited the core files (the model that does the "sorting") and added the right statement in the DB query. The file is: components/com_k2/models/itemlist.php.
You can actually make more complicated sorting this way. Of course, a plugin or an implementation in the core component would be much better...
Hope this helps.
If you have any more questions, let me know.
This is a web directory I used K2 to build.
The client wanted to sort according to the Bids (i.e. how much a person pays for the link) and if the bids are the same, they will be sorted by users rating.
You can have a look here: munexus.com
A category this comes into effect is this: munexus.com/internet.html
I didn't create a plugin or anything - I just edited the core files (the model that does the "sorting") and added the right statement in the DB query. The file is: components/com_k2/models/itemlist.php.
You can actually make more complicated sorting this way. Of course, a plugin or an implementation in the core component would be much better...
Hope this helps.
If you have any more questions, let me know.
Please Log in or Create an account to join the conversation.
- swansonwc
-
- Offline
- New Member
Less
More
- Posts: 11
14 years 1 month ago #95260
by swansonwc
Replied by swansonwc on topic Adding a secondary sorting criteria
Yonatan,
Thank you. That's very helpful.
Best regards,
Bill
Thank you. That's very helpful.
Best regards,
Bill
Please Log in or Create an account to join the conversation.