photo

Richard Wisniewski

shared this question
5 years ago

Employees Involved

photo

PIV Support

Admin

Statistics

4
Comments
378
Views

Relates to

Share

1
votes

search by listing ids

I am making a custom search page and want to inlcude a text box to find comma seperated listing ids. However, if I make a search box for this, no results will return if the box is left empty.

<input type="text" name="listing_id">

or

<input type="text" name="listing id">

they will acheive the same results.

If i type listing id's it will search the listing numbers entered. If I leave the search box blank, it will always return 0 results no matter what other options are checked.

Please help!

Add Comment

Comments (4)

photo Employee
1

If you are including a 'listing_id" input form field, you are passing AND logic to the search engine when your form is submitted.

You are basically saying show me listings that meet all the other search criteria AND with a listing_id# of null (or zero). Thus, there will never be a match.

action=searchresults&your_other_get_vars=xyz&listing_id=

You will need to include some conditional form validation in your custom search page so that if your "listing_id" field is empty, the listing_id GET variable is not passed to the search results page (i.e. OR's search engine).

action=searchresults&your_other_get_vars=xyz

http://www.w3schools.com/php/php_get.asp

photo
1

Excuse my ignorance... :) but as far as I know is not possible to create a "comma separated" search HTML input! Am I wrong??? :)

photo Employee
1

Eduardo Marques wrote:

Excuse my ignorance... :) but as far as I know is not possible to create a "comma separated" search HTML input! Am I wrong??? :)
The OR search engine will accept the listing_id GET var contents as comma separated values, e.g.:

  1. &listing_id=1,2,3
  2. <input type="text" name="listing_id" value="1,2,3" />

photo
1

PIV Support wrote:

The OR search engine will accept the listing_id GET var contents as comma separated values, e.g.:
THANKS! I didn't know that!

Leave Comment

photo

Attach files...

The file must be a jpg, gif, png, bmp, ico, pdf, doc, rtf, txt, zip or rar no more than 20M