Project

General

Profile

Actions

Bug #19483

closed

alternativeSortingField does not work for other languages

Added by Stefan Jelner over 15 years ago. Updated 7 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 #1

Updated by Manuel Stofer over 15 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.

Actions #2

Updated by Stefan Sprenger over 13 years ago

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

Actions #3

Updated by Chris topher about 13 years ago

Hi guys,

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

Actions #4

Updated by Tomas Norre Mikkelsen over 11 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

Actions #5

Updated by Riccardo De Contardi about 11 years ago

Still a problem in 4.7.6

Actions #6

Updated by Lorenz Ulrich over 9 years ago

This is still present in TYPO3 6.2.

Actions #7

Updated by Manuel Selbach about 9 years ago

  • Target version set to next-patchlevel

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

Actions #8

Updated by Christian Kuhn almost 9 years ago

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

still present in current core versions ...

Actions #9

Updated by Mathias Schreiber over 8 years ago

  • Target version deleted (next-patchlevel)
Actions #10

Updated by Gerrit Code Review about 7 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

Actions #11

Updated by Gerrit Code Review about 7 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

Actions #12

Updated by Gerrit Code Review about 7 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

Actions #13

Updated by Gerrit Code Review about 7 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

Actions #14

Updated by Gerrit Code Review about 7 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

Actions #15

Updated by Gerrit Code Review about 7 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

Actions #16

Updated by Gerrit Code Review about 7 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

Actions #17

Updated by Gerrit Code Review about 7 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

Actions #18

Updated by Gerrit Code Review about 7 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

Actions #19

Updated by Gerrit Code Review about 7 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

Actions #20

Updated by Gerrit Code Review about 7 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

Actions #21

Updated by Gerrit Code Review about 7 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

Actions #22

Updated by Susanne Moog over 6 years ago

  • Category set to Localization
Actions #23

Updated by Gerrit Code Review almost 6 years 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

Actions #24

Updated by Benni Mack over 5 years ago

  • Status changed from Under Review to New
Actions #25

Updated by Eric Harrer 8 months ago

  • Related to Story #101560: FlexForm related translation issues added
Actions #26

Updated by Eric Harrer 8 months ago

Since in current TYPO3 versions pages of all languages are stored in the same table, my question is: Is this still a problem in current TYPO3 versions?

Actions #27

Updated by Eric Harrer 8 months ago

  • Related to deleted (Story #101560: FlexForm related translation issues)
Actions #28

Updated by Eric Harrer 8 months ago

  • Related to Epic #101557: Translation Handling Findings added
Actions #29

Updated by Christian Kuhn 7 months ago

  • Status changed from New to Closed

Yeah. I suppose it's ok to close here for now.

Actions

Also available in: Atom PDF