[SOLVED] Use the overwriteDemand in news to get the selected sys_category information

I have a page template that needs the selected category image as background in the sidebar, this is not available outside of the news pages so I am trying to use GP:tx_news_pi1|overwriteDemand|categories for the selection of the category but my typoscript does not work as I intend:
(i started trying to get only the image, eventually I’d need also the title and description, the code is part of my PAGE object)


            60 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
            60 {
                # access sys_category images trough news, outside of the extension
                # https://stackoverflow.com/questions/76466770/ Julian Hofmann
                if.isTrue.data = GP:tx_news_pi1|overwriteDemand|categories
                references {
                    table = sys_category
                    fieldName = images
                }
                as = cat_images
            }
            70 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            70 {
                if.isTrue.data = GP:tx_news_pi1|overwriteDemand|categories
                table = sys_category
                dataProcessing {
                    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
                    10 {
                        references.fieldName = images
                    }
                }
                as = cat_info
            }

Hi Gert-jan!

Welcome to talk.typo3.org!

As far as I can see, this line looks correct for checking if there are categories available: if.isTrue.data = GP:tx_news_pi1|overwriteDemand|categories.

However, as far as I can see, you’re not supplying these categories as input anywhere else. That means TYPO3 doesn’t know which category UIDs to fetch.

The solution should be pretty simple. Because DatabaseQueryProcessor uses the standard TypoScript select semantics, you should be able to add uidInList to your configuration. Here’s an untested example:

            70 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            70 {
                if.isTrue.data = GP:tx_news_pi1|overwriteDemand|categories
                table = sys_category
-->             uidInList.data = GP:tx_news_pi1|overwriteDemand|categories
                dataProcessing {
                    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
                    10 {
                        references.fieldName = images
                    }
                }
                as = cat_info
            }

absolutely right, I approached it differently, but the bug was the same, in any case did I try to get the image with dataProcessing.60 (I see now that I can get the image & the info in the same go)… I posted on stackoverflow and got the solution (and correct typoscript): https://stackoverflow.com/questions/79324775/

That’s great to hear. Thanks for posting the link to the solution here. :heart:

thanks anyhow …

you have a very good reaction time !!

this time I did my question on Stackoverflow, and bulk-mailed it to about 25 competent programmers,

that worked out and I could go further with my site …

I did not know this ‘talk’ site before,

thanks, I’ll be back !! gerry

(Attachment FOa0Mj7wpX4B9I1K.svg is missing)

1 Like