Search Results Display TWICE

Permalink 2 users found helpful
I have my Site Search added to the top of each page via Page Defaults. This block is directing the results to be posted to another page (/search-results) which I created in the sitemap.

On my Search Results Page, I added the search block to my main content area to capture the search results.

However, the results are ALSO showing up in the main site search box on the top of the page...which looks horribly silly.

Why is it doing this?

Thanks.

leinteractive
 
Mainio replied on at Permalink Best Answer Reply 1 Attachment
Mainio
Hi,

You need to set a custom template that does not show the results.

1. Download the attached file
2. Extract it in your /site_dir/blocks/
3. Edit the page defaults and click the search block you have there
4. Click "Custom Template"
5. Select "Search Form Only"

Br,
Antti / Mainio
leinteractive replied on at Permalink Reply
leinteractive
Most excellent! Thank you!
mesuva replied on at Permalink Reply
mesuva
I'm finding the need to do this on most of the sites I'm building at the moment as they have search boxes in their headers/footers. This is how I solve this problem, but two things come to mind:

- Since there end up being two search blocks on the page, is it doing the actual search twice?

- As this is such a common thing to do, is it perhaps something that should be built into the core block (something like a checkbox that says 'don't display results, show the form only'. Or perhaps if the block is set to post to another page, it shouldn't try to create results. I'm thinking this wouldn't be difficult to add to the block, so I'm wondering if there is a reason it hasn't been done already..? (I haven't seen 5.5 yet, so I don't know if there are upcoming changes to core blocks like this)
Mainio replied on at Permalink Reply
Mainio
Nope, nothing upgraded in the 5.5 latest build with this issue.

Actually it does do the search twice if there are two search blocks on the page.

I also feel that it should be possible to control this. Either there should be two different blocks to do this "Search Form" and "Search Results" or there should be checkboxes for these:
- Display search form
- Display search results

This would be quite easy to do, the reason why core team does not focus on these issues usually is that they can get the functionality they need with these blocks. If you'd like something to happen on it, I think git issue tracker would be the correct place to tell so:
https://github.com/concrete5/concrete5/issues...
bjalexander replied on at Permalink Reply
bjalexander
A year and a half later ... this answer is still great. Thanks for getting me out of a bind.
ClickAccount replied on at Permalink Reply
ClickAccount
2014 and still very helpful. thanks!!
JohntheFish replied on at Permalink Reply
JohntheFish