Keyword

Adding a secondary sorting criteria

  • Yonatan Kra
  • Yonatan Kra's Avatar Topic Author
  • Offline
  • New Member
More
13 years 6 months 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 :)

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

  • Yonatan Kra
  • Yonatan Kra's Avatar Topic Author
  • Offline
  • New Member
More
13 years 6 months 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.

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

More
13 years 5 months 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.

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

  • Yonatan Kra
  • Yonatan Kra's Avatar Topic Author
  • Offline
  • New Member
More
13 years 5 months 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.

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

More
13 years 5 months ago #95260 by swansonwc
Replied by swansonwc on topic Adding a secondary sorting criteria
Yonatan,

Thank you. That's very helpful.

Best regards,

Bill

 

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


Powered by Kunena Forum