close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

search results

Thread began 9/23/2015 8:43 am by Jamie | Last modified 9/25/2015 11:26 am by Ray Borduin | 2170 views | 11 replies |

Jamie

search results

Hey Ray,

On the search results page, such as http://clients.motley.site/friths2/shopsearch.php?shopSearchInput=test&WADbSearch1=Search+Shop, how would I get the search term(s) added to the page here http://prntscr.com/8jm36d ? (and also add to the failed search message)

Also, if the visitor does a blank search how do you stop all products being returned?

Lastly, you mentioned in email a couple of weeks ago when you had your power cut that you would give me a bit of a steer on the search function. At the moment its seems that you can only search by words in sequence (eg 'monthly' or 'monthly disposable'). How would go about making it so that if you did a search for 'johnson
monthly' it would return any combination that has both johnson and monthly in it? You asked if I was usingthe search object and I repliedm that I wasnt sure...

Have attached the file here

Many thanks

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

You can save the search terms in the session on top of the page:

php:
<?php

@session_start();
if (isset(
$_GET['shopSearchInput'])) {
  
$_SESSION["shopSearchInput"] = $_GET['shopSearchInput'];
}
?>



Then display it where you want to from the session.

I think you can get it to use AND for any space by defining space as the and on line 16 like:
$searchProducts_1->setSearch(array("type"=>"k","comparison"=>"like", "and"=>" ") ...

I think the easiest way to get it to not return results with a blank search would be to add a search param that returned no results below the current search like:

php:
<?php

if ((isset($_GET["shopSearchInput"])) && ($_GET["shopSearchInput"] === "")) {
  
$searchProducts_1->clearSearch();
  
$searchProducts_1->setSearch(array("type"=>"v","comparison"=>"="), array("ProductSKU"), "s""0");

}
?>



That should only return rows with the SKU is = 0, which I assume would be no results.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thanks. have got the session working fine.

unfortunately, the returning no results and the search keywords arent. I may not have done it right? updated file attached.

Sign in to reply to this post

Ray BorduinWebAssist

I had the wrong GET variable in the IF statement. Try with the updated code. (I've updated my previous post)

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thanks Ray but thats had no effect...

Sign in to reply to this post

Ray BorduinWebAssist

I'll need FTP access and a URL to debug.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

here you go

Sign in to reply to this post

Ray BorduinWebAssist

I got it working. I had the default no results search searching for "0" which it treated as an empty search. That should be working now.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

great thanks. do I need to download any other file other than the shopsearch.php one?

Also, on a blank search the content shown is http://prntscr.com/8k8s1u which is the same content of a 'failed' search but on a failed search it highlights the searched words - I would I modify the blank search to use a different text?

Sign in to reply to this post

Ray BorduinWebAssist

You could... just use the same IF statement for the secondary search to show a secondary message.

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...