Superboxselect and SimpleSearch

I would like use simplesearch to search Template Variables when searching the site. It works fine with TVs the are tags, text, etc.

But I am using SuperBoxSelect to populate one of the TVs. I know how to display the info on the page via getResources or pdoResources just fine. However I need simplesearch to search based on the pagetitle of the resources not their ids. Since superboxselect stores the ids in the TV.

Is there any possible to get simplesearch to use the pagetiitles instead of the ids for resource in the TV?

I welcome any suggestions.


Can multiple resources be selected in your SuperBoxSelect-TV or have you set the input option “Max. Elements:” to 1, so that only one resource can be selected?

If multiple resources can be selected, then you probably have to create a custom database table to save these connections between resources, because these id-values separated by double pipes (e.g. 2||12) are hard to query.

To store the tv values to a custom database table, you have to create a custom plugin that runs on the events OnDocFormSave.

With your custom database table you should then be able to use the property &customPackages in your call to SimpleSearch.
I’m not exactly sure if this works though, maybe you also have to make some small changes to the code.

Here is another idea that is uglier, but probably easier to implement:

Create an additional TV of “Input Type” = Hidden for your template.

Then in a custom plugin on the event OnDocFormSave, read the value of the SuperBoxSelect-TV, loop through the ids, query the corresponding pagetitles and save them to the new Hidden-TV.

Then use the Hidden-TV (with the pagetitles as the value) in your call to SimpleSearch.

You also need a way to update the TV-values if the pagetitle of a resource changes.
You could also do this in your plugin. On the event OnBeforeDocFormSave, check if the pagetitle has changed. If that is the case, loop through all your SuperBoxSelect-TVs and if the resource-id is in the list, update the value of the Hidden-TV.