[FEATURE] add sorting on sys_category 15/23615/3
authorPeter Niederlag <netservice@niekom.de>
Wed, 4 Sep 2013 15:11:06 +0000 (17:11 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Sat, 21 Sep 2013 08:40:10 +0000 (10:40 +0200)
sys_category until now misses a specific sort order
and is sorted by title. Adding a sorting property
gives more flexibility in sorting by custom
needs.

tca treeConfig of sys_category as well as categoryRegistry
are adapted accordingly

Change-Id: I663fb24dcd5486f911e256fe1a42c445a63543be
Resolves: #51590
Releases: 6.2
Reviewed-on: https://review.typo3.org/23615
Reviewed-by: Francois Suter
Tested-by: Francois Suter
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/core/Classes/Category/CategoryRegistry.php
typo3/sysext/core/Configuration/TCA/sys_category.php
typo3/sysext/core/ext_tables.sql

index 3cd4f83..4aca08d 100644 (file)
@@ -297,7 +297,7 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                        $fieldConfiguration = array(
                                'type' => 'select',
                                'foreign_table' => 'sys_category',
-                               'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC',
+                               'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC',
                                'MM' => 'sys_category_record_mm',
                                'MM_opposite_field' => 'items',
                                'MM_match_fields' => array(
@@ -366,4 +366,4 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
        }
 }
 
-?>
\ No newline at end of file
+?>
index 451fbf6..06953c6 100644 (file)
@@ -7,7 +7,7 @@ return array(
                'crdate' => 'crdate',
                'cruser_id' => 'cruser_id',
                'delete' => 'deleted',
-               'default_sortby' => 'ORDER BY title ASC',
+               'sortby' => 'sorting',
                'dividers2tabs' => TRUE,
                'versioningWS' => 2,
                'rootLevel' => -1,
@@ -136,7 +136,7 @@ return array(
                                'type' => 'select',
                                'renderMode' => 'tree',
                                'foreign_table' => 'sys_category',
-                               'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1,0) ORDER BY sys_category.title ASC',
+                               'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1,0) ORDER BY sys_category.sorting ASC',
                                'treeConfig' => array(
                                        'parentField' => 'parent'
                                )
index 73a9300..7191b54 100644 (file)
@@ -630,6 +630,7 @@ CREATE TABLE sys_category (
        t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
        t3ver_move_id int(11) DEFAULT '0' NOT NULL,
        t3_origuid int(11) DEFAULT '0' NOT NULL,
+       sorting int(11) unsigned DEFAULT '0' NOT NULL,
 
        sys_language_uid int(11) DEFAULT '0' NOT NULL,
        l10n_parent int(11) DEFAULT '0' NOT NULL,