TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 136
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 145
  • Total: 145

[SOLVED]Sort Download Items by Number of Downloads

Started by PureLoneWolf, July 22, 2012, 04:18:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PureLoneWolf

Link to my site: http://www.resurrectionremix.com
SMF version: SMF 2.0.2
TP version: 1.0 Final
Default Forum Language: English
Theme name and version: Curve
Mods installed: TinyPortal, Ohara Youtube Embed, Tapatalk SMF 2.0 RC4/RC5/Final Plugin, FAQ Mod, SMF Gallery Lite, Attention Lost Topic, Discourage IE6, Hide IP for users, seperate sticky topics, signature area BBCode, Smart Pagination, Sneaky Editing, Topic Rating Bar, Thank-O-Matic, BBC Spoiler, RSS Feed Icon


Hi there

Is it possible to sort the download items by the number of downloads (highest to lowest)?

I saw this http://www.tinyportal.net/index.php?topic=18798.msg154366#msg154366 but there are so many ORDER BY statements and I only want to do this for download items, not categories.

I assume that I would change "name" to "downloads" and ASC to DESC, but as I said, I don't see which lines I should be changing in TPdlmanager.php

Is this something someone could help with?

Thanks in advance

IchBin

Do you mean when you have multiple items under the same download? I'm not sure I'm following your description.

PureLoneWolf

Lets say I have a category called Mods - I have manually positioned this as 2nd in my category list and that is absolutely spot on.

When I go into the Mods category - There are 5 files available to download, that have all been downloaded multiple times, but they are displayed by uploaded item number (I think)

So I get

Item 1 - 20 downloads
Item 2 - 4 downloads
Item 3 - 300 downloads
Item 4 - 800 downloads
Item 5 - 48 downloads

I would like for them to be sorted by the amount of downloads they have - so the above would display:

Item 4 - 800 downloads
Item 3 - 300 downloads
Item 5 - 48 downloads
Item 1 - 20 downloads
Item 2 - 4 downloads

And if Item 1 increased to 50, I would see:

Item 4 - 800 downloads
Item 3 - 300 downloads
Item 1 - 50 downloads
Item 5 - 48 downloads
Item 2 - 4 downloads

Hopefully that makes it clearer, apologies for any confusion

Thanks

IchBin

Ah, so items in the category then. That shouldn't be hard. I'll take a look at the code when I get a free moment here.

IchBin

In Sources/TPdlmanager.php around line #808 find this code:
$context['TPortal']['dlsort'] = $dlsort = 'id';

Change it to this:
$context['TPortal']['dlsort'] = $dlsort = 'downloads';

PureLoneWolf


This website is proudly hosted on Crocweb Cloud Website Hosting.