0
votes

I followed the 'Creating an Extbase extension' in the TYPO3 documentation and build the Product Overview, all working fine.

The next step teaches 'Extending an Extbase extension' and also that works but the last step changes the TCA in order to select stored categories rather then add them inline ...

The list displays the selection possibility with the created categories and I can select them but they do not save, if I check the db the category is saved but it does not show up in the backend, and typo3 does not recognize the category saved in the field ...

can anyone give the final steps needed to make it work ... (I already installed, dis-installed, cleared cache, cleaned with install tool etc. multiple times...)

this is my tca:

/* original working inline code
        'categories' => [
            'exclude' => 1,
            'label' => 'LLL:EXT:productoverview/Resources/Private/Language/locallang_db.xlf:tx_productoverview_domain_model_product.categories',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_productoverview_domain_model_category',
                'foreign_field' => 'product',
                'maxitems' => 9999,
                'appearance' => [
                    'collapseAll' => 0,
                    'levelLinksPosition' => 'top',
                    'showSynchronizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                    'showAllLocalizationLink' => 1
                ],
            ],

        ],
suggested category selection */
        'categories' => [
          'exclude' => 0,
          'label' => 'LLL:EXT:productoverview/Resources/Private/Language/locallang_db.xml:tx_productoverview_domain_model_product.categories',
          'config' => [
            'type' => 'select',
            'renderType' => 'selectMultipleSideBySide',
            'foreign_table' => 'tx_productoverview_domain_model_category',
            'foreign_field' => 'product',
            'maxitems'      => 9999,
          ],
        ],

    ],
];

update: I found this answer of 2 years ago which gives an error in v7.6.14 but explains a lot, I still hope to have a much simpler answer here ...

2
Do you have created the foreign_table?René Pflamm
can you please display your tca code?Vivek Parmar
@RenéPflamm ... I did only what given in the tutorial you mean 'foreign_table' => 'tx_productoverview_domain_model_category'webMan
@VivekParmar the whole code ? that's long ... its exactly from the documentation, but I post if you want ...webMan
no just some portion of 'category'.Vivek Parmar

2 Answers

1
votes

I faced the same problem a few days ago, when updating an old project. What fixed the problem for me, was to define a renderType in addition to type=select: https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html#rendertype

1
votes

I did try the solution of j4k3 (because also other experienced developers suggested it) but I could not make it work on my localhost and never found out why (still interested in that, I run xampp on windows 7 pro) ...

Eventually I did find a solution that worked for me that is very simple: In the current extension builder you have the option to select the relation type from a select list,

I left this (never being mentioned in the ExtbaseGuide) to 1:n because that is the actual needed relation, but now I used m:n and my trouble vanished, the builder automatically creates an extra MM relation table and the full TCA code, it works straight after the extension is saved by the builder ...