Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

How can I add an eBay search box that searches titles and descriptions?

Dave, I got the search box into my site (as detailed here: Add an eBay search box to your Web site) but I need to be able to use it to search both title and description. I have not had any luck getting that part in. I need this because I encode the description of an eBay listing with a specific number giving my customers an easy way to look at their items only. Thanks for the help


Dave's Answer:

The default eBay search is pretty easy to emulate because, well, it's simple. Being able to duplicate the more sophisticated functionality of its advanced search is a bit more tricky, because we need to crack open the HTML itself and see what's inside.

The default search is certainly attractive enough:

eBay Advanced Search

Crack open the HTML code, however, and the form is insanely complicated, so complicated that I couldn't really make head nor tail of it without stripping away some of the core functionality. Nonetheless, assume you always want to check all categories and the basic search form can be reduced to:

<form method="get" action="http://search.ebay.com/search/search.dll">
<input type="hidden" name="from" value="R40" />
<input type="hidden" name="_trksid" value="m37" />
<input tabindex="1" type="text" name="satitle" id="satitle" value="" maxlength="300" size="30" />
<input type="hidden" name="category0" value="" />
<input type="submit" value="Search" tabindex="3">
</form>

here's the cool thing, though. Search through the source code for "Search title" and you'll find that there's a single checkbox value that makes that option work:

<input type="checkbox" name="fts" value="2" />Search title <b>and</b> description<br />

My question, therefore, is what happens if I just make this checkbox available in the simple form shown earlier? Just literally copy and paste that single line of HTML. Here's the result:

  Search title and description

A bit of testing will reveal that it works perfectly! If you want to just hide the setting, turn the checkbox into a hidden variable, paying attention to the default value that the eBay server wants to receive (detailed in the original HTML):

<input type="hidden" name="fts" value="2" />

Further experimentation shows that some of the variables being sent are unnecessary! In fact you can do just fine with the following code, added line for the checkbox highlighted in bold:

<form method="get" action="http://search.ebay.com/search/search.dll">
<input type="text" name="satitle" value="" maxlength="300" size="30" />
<input type="checkbox" name="fts" value="2" /> search titles and descriptions<input type="submit" value="Search" tabindex="3">
</form>

Or, if you want the minimal search box and know that every time someone wants to search, they really want both title and description:

<form method="get" action="http://search.ebay.com/search/search.dll">
<input type="hidden" name="fts" value="2" />
<input type="text" name="satitle" value="" maxlength="300" size="30" />
<input type="submit" value="Search" />
</form>

Hope that helps you customize your page!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

I'd add this box into my site and it's working just fine

Posted by: Pradeep Kumar at February 23, 2008 4:15 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]