0
votes

We have an typo3 instance (8.7), and sometimes it happens, that over hundred of sites the content elements are resorted in an wrong way. It is definitely not done by an user of the system.

Our company has many typo3 projects and the big difference here, is our self developed extension, where you can create records and the record can contain tt_content elements.

TCA of the "field":

        'content' => [
        'exclude' => 0,
        'label' => 'Content',
        'config' => [
            'type' => 'inline',
            'foreign_table' => 'tt_content',
            'foreign_sortby' => 'sorting',
            'foreign_field' => 'event',
            'foreign_record_defaults' => [
            ],
            'maxitems' => 9999,
            'appearance' => [
                'collapse' => 1,
                'levelLinksPosition' => 'top',
                'showSynchronizationLink' => 1,
                'showPossibleLocalizationRecords' => 1,
                'showAllLocalizationLink' => 1,
                'useSortable' => 1,
                'enabledControls' => [
                    'dragdrop' => 1
                ],
            ],
        ],
    ],

The pid of the tt_content element is set with an hook.

The main problem is, I can´t reproduce this behaviour and it happens not very often.

1
The only thing I could point out is: the "sorting" field is usually managed by TYPO3 itself (it's set in tt_content TCA on ctrl/sortby). So whenever someone decides to edit/move/delete/add a tt_content record, the sorting field might get updated under certain conditions. It might be worth a shot to use a different field for sorting in this relationship.Nitori

1 Answers

1
votes

How does TYPO3 organize the sorting of (content) records?

TYPO3 in general uses a field named sorting. the values are not consecutive, so not all records need an update for an insertion or remove of single records. Only on collisions the values are renumbered.

For tt_content you have one special handling: as the content is organized in columns (identified by field colPos) the sorting of each column is individual.
In this way you can have multiple chains of sorting values for each colPos.


In your definition you have no colPos value for the inserted tt_content records. Maybe that results in confusion when records are sorted and all sorting-values are rewritten without respecting the colPos field.


You can find similar chaos if you have records where the order of appearance is given by another field (e.g. title). if you define sortby = title the records are shown in this order - until TYPO3 thinks it must renumber the sorting field. this would result in Numbers overwritten titles. (**Don't use sortby =, but orderBy =)