Category Sorting

You have a suggestion for a future version of phpMyFAQ? Then post it here!

Moderator: Thorsten

Post Reply
an.d
Posts: 1
Joined: Thu May 24, 2018 4:30 pm

Category Sorting

Post by an.d »

Instead of sorting by id it would be better if you added a column called sortorder and used that to sort the columns of the categories. That way when ever you change the sort order you don't have to go back in and correct all of the FAQs that are now in the wrong category. That should be a simple fix and not require a lot of change in the code or the database.
Thorsten
Posts: 15617
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Category Sorting

Post by Thorsten »

Hi,

for sure it needs a database and a code change...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
trf000
Posts: 37
Joined: Tue Nov 23, 2010 5:16 pm

Re: Category Sorting

Post by trf000 »

It would also allow you to do drag and drop sorting. As it is, sorting categories is a little cumbersome.
PaoloKappa
Posts: 11
Joined: Wed Sep 17, 2014 5:35 pm
Location: Stabio, Switzerland, Europe
Contact:

Re: Category Sorting

Post by PaoloKappa »

Edit /var/www/html/inc/PMF/Categories.php and add ORDER BY fc.name (line 235)

SELECT
fc.id AS id,
fc.lang AS lang,
fc.parent_id AS parent_id,
fc.name AS name,
fc.description AS description,
fc.user_id AS user_id,
fc.group_id AS group_id,
fc.active AS active
FROM
%sfaqcategories fc
LEFT JOIN
%sfaqcategory_group fg
ON
fc.id = fg.category_id
LEFT JOIN
%sfaqcategory_user fu
ON
fc.id = fu.category_id
%s
GROUP BY
fc.id, fc.lang, fc.parent_id, fc.name, fc.description, fc.user_id, fc.group_id, fc.active
ORDER BY
fc.name,fc.parent_id, fc.id',
Post Reply