Search code examples
typo3typoscriptdata-processingtypo3-9.x

Get sys_category items to show up in menu via dataProcessing / DatabaseQueryProcessor


The menu works. But cats is always empty. data.categories shows the count of how many categories are assigned to the given page. But cats array only shows: cats => array(empty). What's wrong with my TYPOSCRIPT?

        40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        40 {
            expandAll = 1
            levels = 7
            as = menuMain
            dataProcessing {
                100 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
                100 {
                    if.isTrue.field = categories
                    table = sys_category
                    select {
                        pidInList = root,-1
                        selectFields = sys_category.*
                        join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
                        where.data = field:_ORIG_uid // field:uid
                        where.intval = 1
                        where.wrap = sys_category_record_mm.uid_foreign=|
                        orderBy = sys_category_record_mm.sorting_foreign
                        languageField = 0 # disable translation handling of sys_category
                    }
                    as = cats
                }
            }
        }

Solution

  • There is no "select" parameter for the DatabaseQueryProcessor. So you should remove it and move all the sub-parameters one level up.

        40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        40 {
            expandAll = 1
            levels = 7
            as = menuMain
            dataProcessing {
                100 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
                100 {
                    if.isTrue.field = categories
                    table = sys_category
                    pidInList = root,-1
                    selectFields = sys_category.*
                    join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
                    where.data = field:_ORIG_uid // field:uid
                    where.intval = 1
                    where.wrap = sys_category_record_mm.uid_foreign=|
                    orderBy = sys_category_record_mm.sorting_foreign
                    languageField = 0 # disable translation handling of sys_category
                    as = cats
                }
            }
        }