Bug #19483

alternativeSortingField does not work for other languages

Added by Stefan Jelner about 11 years ago. Updated 12 months ago.

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

0%

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)

class.tslib_menu.php View (889 Bytes) Administrator Admin, 2008-10-20 14:33

class.tslib_menu.php.patch View (2.46 KB) Administrator Admin, 2010-08-10 14:36

History

#1 Updated by Manuel Stofer almost 11 years ago

i also think there should be two sorting functions, that you can sort from original page and language overlay. for example you might want to sort with crdate (either sorted with the crdate of original page or with language overlay).

but i think sorting should not be done on database table field level. you might want to sort with nav_title of language overlay page, if nav_title is not specified in Language overlaypage you will want to use title of the language overlay page to sort.

#2 Updated by Stefan Sprenger about 9 years ago

I've added a patch that fixes the wrong behavior for menus having type "directory".

#3 Updated by Chris topher over 8 years ago

Hi guys,

is that problem still present?
If so, please push the patch to Gerrit!

#4 Updated by Tomas Norre Mikkelsen about 7 years ago

  • Target version deleted (0)

Hi,

I can confirm that this is still a problem in TYPO3 4.7.2 dont know for 4.7.3/4

/Tomas

#5 Updated by Riccardo De Contardi almost 7 years ago

Still a problem in 4.7.6

#6 Updated by Lorenz Ulrich about 5 years ago

This is still present in TYPO3 6.2.

#7 Updated by Manuel Selbach over 4 years ago

  • Target version set to next-patchlevel

I would really appreciate if you could include this issue in the next minor update.

#8 Updated by Christian Kuhn over 4 years ago

  • Description updated (diff)
  • Is Regression set to No

still present in current core versions ...

#9 Updated by Mathias Schreiber almost 4 years ago

  • Target version deleted (next-patchlevel)

#10 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51506

#11 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51507

#12 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51507

#13 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#14 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#15 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#16 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51507

#17 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#18 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#19 Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#20 Updated by Gerrit Code Review over 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#21 Updated by Gerrit Code Review over 2 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#22 Updated by Susanne Moog almost 2 years ago

  • Category set to Localization

#23 Updated by Gerrit Code Review over 1 year ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51508

#24 Updated by Benni Mack 12 months ago

  • Status changed from Under Review to New

Also available in: Atom PDF