[albums] Auto sort of the categories: add a auto sort per dir name #335

Closed
opened 2026-10-04 23:52:38 +02:00 by adam · 7 comments
Owner

Reported by Eric B on 11 Jun 2006 21:55

Version: 1.6.0RC2

In Categories management, there is a "order alphanumerically" button, but it only takes care of the categories name. I wish I could have a similar button for the directories names which are my main categories that I'm used to rename.

Piwigo Bugtracker #412

**Reported by Eric B on 11 Jun 2006 21:55** **Version:** 1.6.0RC2 In Categories management, there is a &quot;order alphanumerically&quot; button, but it only takes care of the categories name. I wish I could have a similar button for the directories names which are my main categories that I&#039;m used to rename. [Piwigo Bugtracker #412](http://piwigo.org/bugs/view.php?id=412) <!-- github-sync-id:97254094 -->
adam closed this issue 2026-10-04 23:52:38 +02:00
Author
Owner

Comment posted by plg on 13 Jun 2006 15:30

I don't understand the logic :-/ Only the category name is displayed, not the directory name (which is available only if the category is physical). Such a sort won't work for virtual categories.

By default for a physical category, category name = directory name. After creation, you can modify the category name the way you want, without taking into account the directory name.

**Comment posted by plg on 13 Jun 2006 15:30** I don&#039;t understand the logic :-/ Only the category name is displayed, not the directory name (which is available only if the category is physical). Such a sort won&#039;t work for virtual categories. By default for a physical category, category name = directory name. After creation, you can modify the category name the way you want, without taking into account the directory name. <!-- github-comment-id:124888610 -->
Author
Owner

Comment posted by Eric B on 13 Jun 2006 18:40

So, it may depend on the way I am using the directory and the category names. As far as I am concerned, I always put the date (e.g. 060613_) as prefix of my directories to ensure that there are ordered chronologically in my filesystem. Then, when I upload them in PWG, I remove this prefix because it is not very beautiful in menu, but I want to keep the ordering of the dir names with this prefix.

**Comment posted by Eric B on 13 Jun 2006 18:40** So, it may depend on the way I am using the directory and the category names. As far as I am concerned, I always put the date (e.g. 060613_) as prefix of my directories to ensure that there are ordered chronologically in my filesystem. Then, when I upload them in PWG, I remove this prefix because it is not very beautiful in menu, but I want to keep the ordering of the dir names with this prefix. <!-- github-comment-id:124888626 -->
Author
Owner

Comment posted by plg on 13 Jun 2006 19:30

Roadmaped for branch 1.7, I would like to improve the concept of "automatic sorting". Choosing the field (name, directory, last update), the order (ascending, descending) and the target (the sub-categories of the current categories or the whole sub-tree). In this context, this feature request is related to #408.

To solve your immediate problem, here is the specific solution... Release 1.6.x, in admin/cat_list.php, line 121, replace

SELECT id, name

by

SELECT id, name, dir

... then line 129, replace

$categories[ $row[&#039;id&#039;] ] = strtolower($row[&#039;name&#039;]);

by

$categories[ $row[&#039;id&#039;] ] = strtolower($row[&#039;dir&#039;]);
**Comment posted by plg on 13 Jun 2006 19:30** Roadmaped for branch 1.7, I would like to improve the concept of &quot;automatic sorting&quot;. Choosing the field (name, directory, last update), the order (ascending, descending) and the target (the sub-categories of the current categories or the whole sub-tree). In this context, this feature request is related to #408. To solve your immediate problem, here is the specific solution... Release 1.6.x, in admin/cat_list.php, line 121, replace SELECT id, name by SELECT id, name, dir ... then line 129, replace ``` $categories[ $row[&#039;id&#039;] ] = strtolower($row[&#039;name&#039;]); ``` by ``` $categories[ $row[&#039;id&#039;] ] = strtolower($row[&#039;dir&#039;]); ``` <!-- github-comment-id:124888640 -->
Author
Owner

Comment posted by VDigital on 14 Feb 2008 16:07

To close ?

**Comment posted by VDigital on 14 Feb 2008 16:07** To close ? <!-- github-comment-id:124888656 -->
Author
Owner

Comment posted by plg on 4 Jun 2008 21:21

VDigital wrote:

> To close ?

No, I don't think so. The idea is good, nothing was implemented yet, I just gave a hardcoded workaround. I still want to add an enhanced "sort form" on categories management page.

**Comment posted by plg on 4 Jun 2008 21:21** VDigital wrote: &gt; To close ? No, I don&#039;t think so. The idea is good, nothing was implemented yet, I just gave a hardcoded workaround. I still want to add an enhanced &quot;sort form&quot; on categories management page. <!-- github-comment-id:124888665 -->
Author
Owner

Comment posted by Eric B on 25 Nov 2012 09:06

4 years later, I think this issue can be closed, it is possible to sort the categories in v2.4.5

**Comment posted by Eric B on 25 Nov 2012 09:06** 4 years later, I think this issue can be closed, it is possible to sort the categories in v2.4.5 <!-- github-comment-id:124888667 -->
Author
Owner

In recent versions of Piwigo can sort by date, so I close the issue.

In recent versions of Piwigo can sort by date, so I close the issue. <!-- github-comment-id:215349173 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#335