Category Sorting
Moderator: Thorsten
Category Sorting
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.
Re: Category Sorting
Hi,
for sure it needs a database and a code change...
bye
Thorsten
for sure it needs a database and a code change...
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Re: Category Sorting
It would also allow you to do drag and drop sorting. As it is, sorting categories is a little cumbersome.
-
- Posts: 11
- Joined: Wed Sep 17, 2014 5:35 pm
- Location: Stabio, Switzerland, Europe
- Contact:
Re: Category Sorting
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',
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',