RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 08/23/2018 : 06:49:45
I would like to be able to display a heading on the product search results page such as 'Search results for: 'search term' '. In particular I would like the heading to display when nobox=true is set.
I think the search could be further enhanced with a predictive database lookup similar to the adminorders page product entry auto complete. I've seen some nice search enhancements on sites with predictive matches, suggested product categories and recommended products with thumbnails.
I'm often surprised when customers contact me having failed to find what they are looking for using the website product search. Adding extra search words to products has helped but I think these suggestions could help further.
Richard.
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 08/23/2018 : 06:55:03
quote: I would like to be able to display a heading on the product search results page such as 'Search results for: 'search term' '. In particular I would like the heading to display when nobox=true is set
I have done this and it's actually quite easy to accomplish with no mods to the core files. Are you on .asp or .php?
Edited by - dbdave on 08/23/2018 06:55:33
|
RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 08/23/2018 : 07:18:04
Hi Dave,
Thank you, that sounds promising ..I'm using php.
Richard.
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 08/23/2018 : 07:54:09
Hi Richard, I have it for .asp, but will need to work it up for .php Perhaps this evening, but soon either way. I'll post it as a tip and give you a heads up when it's posted.
|
RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 08/23/2018 : 08:23:16
That would be great and much appreciated, thank you.
Richard.
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 08/25/2018 : 17:20:16
Hi Richard, feel free to message me for that tip. 
Edited by - dbdave on 08/25/2018 23:00:17
|
RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 09/01/2018 : 10:50:40
Hi Dave,
Thank you for your message. Apologies for the late reply but I've just returned after a short break. Your forum profile doesn't appear to include an email contact so I'm not sure how to message you ..please advise.
Thanks,
Richard.
|
insight
ECT Moderator
USA
4479 Posts |
Posted - 09/01/2018 : 13:37:23
|
RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 09/01/2018 : 13:56:06
Thanks Peter, but I don't see the envelope icon on dbdave's posts. Am I missing something?
Richard.
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 09/01/2018 : 14:22:38
Here you go
This works for both .asp and .php versions. It is updaterproof. The same code is used for both versions
It will show the text that the user searched for. This can be useful if you hide the search box on the search results page.
==HOW TO INSTALL== 1. Open your search.asp/search.php page in your html editor. 2. In the content area of the page you will find the include line as follows <?php include "vsadmin/inc/incsearch.php" ?> for .php <!--#include file="vsadmin/inc/incsearch.asp"--> for .asp
Just above that, add the following line - <div class="searchedfor" id="searchedfor"></div> 3. Just below that, add the following <script> if (document.getElementsByClassName('searchfor')[0].childNodes[0].value != '') { var srchresults = (document.getElementsByClassName('searchfor')[0].childNodes[0].value); var searchedfor = ('Showing results for: '+srchresults); document.getElementById('searchedfor').innerHTML = searchedfor; } </script> 4. Upload to the server.
This is written so nothing happens if no search term is entered and a visitor just navigates to the search page with no search term entered. It can be styled with the class "searchedfor". div.searchedfor {color:red; font-weight:bold; font-size:16px;} for example The text there in the script Showing results for: can be changed to anything you like.
Demo here - http://www.floridasurpluswarehouse.com/dev/search.php?pg=1&stext=monitor As stated, when no search term is entered, there is no output there http://www.floridasurpluswarehouse.com/dev/search.php
Enjoy...

|
RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 09/01/2018 : 15:57:43
Hi Dave,
Thank you very much for that. I have it set up and working on the search page with the search box displayed, but I really wanted it to work when nobox=true is set so it just shows the 'Searched for' text and the search results. Is it possible to set this up to work like that?
Richard.
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 09/01/2018 : 17:25:44
Can I have look at the page? Can you message me a link or post one?
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 09/02/2018 : 10:59:37
Ok, the .php and .asp version is up now - https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=110513 Fully tested on both versions with a demo there in the post.
|
RJB
Ecommerce Template Expert
United Kingdom
792 Posts |
Posted - 09/02/2018 : 11:58:24
Hi Dave, That is now set up and working perfectly. Exactly what I was looking for.
Many thanks.
Richard.
|
dbdave
ECT Moderator
USA
10468 Posts |
Posted - 09/02/2018 : 13:08:22
Great news. Happy to help.
David
|
|
|