Search code examples
typo3typoscripttypo3-9.xtypo3-extensionstypolink

Typolink to the detail page


I use Solr Search with TYPO3 9x and I'm indexing a custom content (sf_books) on it.

When I type a book title in the search form and click on any of the suggestions the link redirects to the list page book instead of the book detail page.

This is my TS setup:

plugin.tx_solr.index.queue {
sfbooks = 1
sfbooks {
    table = tx_sfbooks_domain_model_book
    fields {
        url = CASE
        url {
            key.field = type

            # Internal
            1 = TEXT
            1 {
                if.isTrue.field = internalurl
                typolink.parameter.field = internalurl
                typolink.useCacheHash = 1
                typolink.returnLast = url
            }
            # External
            2 = TEXT
            2 {
                if.isTrue.field = externalurl
                field = externalurl
            }
            default = TEXT
            default {
                typolink.parameter = {$plugin.tx_sfbooks_book.bookPageId}
                typolink.additionalParams = &tx_sfbooks_pi1[controller]=News&tx_sfbooks_pi1[action]=detail&tx_sfbooks_pi1[news]={field:uid}&L={field:__solr_index_language}
                typolink.additionalParams.insertData = 1
                typolink.useCacheHash = 1
                typolink.returnLast = url
            }
        }
    }
}

Solution

  • Sorry but you seem to have copied the config from news and assume that it will just work by replacing the extension key.

    First of there are no fields type, internalurl and externalurl.

    I did not try it because i do not have any solr to test it, but it should work. typolink.additionalParams = &tx_sfbooks_book[controller]=Book&tx_sfbooks_book[action]=show&tx_sfbooks_book[book]={field:uid}&L={field:__solr_index_language}