Project

General

Profile

Actions

Bug #19483

closed

alternativeSortingField does not work for other languages

Added by Stefan Jelner over 15 years ago. Updated 8 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2008-10-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

If you build a TMENU with an alternativeSortingField-entry, in the default language, the sort-order is right. if you switch the language, the menu-entries are translated, but keep the sort-order of the default-language. the cause is, that alternativeSortingField only sorts the table `pages`.

i wrote a quick and dirty solution to my problem:

the behaviour of alternativeSortingField is right. it sorts the table-entries. so i made another directive called "alternativeSortingField2" which sorts the entries, after they are completely cummulated.

example:

menu = HMENU
menu {
entryLevel = 3
1 = TMENU
1 {
alternativeSortingField2 = title ASC
}
}

i changed the code of typo3/sysext/cms/tslib/class.tslib_menu.php in typo3 4.2.0 after line 831:

$altSortField2 = trim($this->mconf['alternativeSortingField2']);
if(isset($altSortField2) && $altSortField2 != '') {
$altSortField2 = preg_split('/[\\s,]+/s',$altSortField2);
if(!isset($altSortField21)) $altSortField21 = 'ASC';
else $altSortField21 = strtoupper($altSortField21);
$type = 'string';
foreach($temp as $gettype) {
if(isset($gettype[$altSortField20])) $type = gettype($gettype[$altSortField20]);
break;
}
$lFunc = 'return strcmp($a["'.$altSortField20.'"],$b["'.$altSortField20.'"]);';
if($type != 'integer' && $type != 'double') {
if($altSortField21 == 'DESC') {
$lFunc = 'return strcmp($b["'.$altSortField20.'"],$a["'.$altSortField20.'"]);';
}
} else {
if($altSortField21 'DESC') {
$lFunc = 'if ($a["'.$altSortField2[0].'"] $b["'.$altSortField20.'"]) { return 0; }'.
' return ($a["'.$altSortField20.'"] < $b["'.$altSortField20.'"]) ? -1 : 1;';
} else {
$lFunc = 'if ($a["'.$altSortField20.'"] == $b["'.$altSortField20.'"]) { return 0; }'.
' return ($b["'.$altSortField20.'"] < $a["'.$altSortField20.'"]) ? -1 : 1;';
}
}
$lambda = create_function('$a,$b',$lFunc);
uasort($temp,$lambda);
}

(issue imported from #M9606)


Files

class.tslib_menu.php (889 Bytes) class.tslib_menu.php Administrator Admin, 2008-10-20 14:33
class.tslib_menu.php.patch (2.46 KB) class.tslib_menu.php.patch Administrator Admin, 2010-08-10 14:36

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Epic #101557: Translation Handling FindingsNew2023-08-03

Actions
Actions

Also available in: Atom PDF