
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 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: ![]() 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: 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 Stumble Upon
Categorized:
Auctions and Online Shopping
,
CGI Scripts and Web Site Programming
(Article 7688)
Tagged: cgi, ebay, html, html forms Previous: How do I quick hide my Windows XP screen? Next: Does Firefox support private Web browsing? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. I'd add this box into my site and it's working just fine Posted by: Pradeep Kumar at February 23, 2008 4:15 AMHi Dave, I must say, I love your work! I wanted to implement a similar thing on my eBay store site, but I'd rather have a neat little box in a position of my choice, instead of using the ugly default eBay side menu. Is there a way to customise the search form so it only searches within my eBay store? Thanks in advance for any help you can offer! Posted by: Graham Bae at October 7, 2008 9:06 AMGraham, thanks for the kudos! You can indeed create an eBay merchant search box. See here: http://www.askdavetaylor.com/how_to_make_ebay_store_merchant_search_box.html See especially the follow-on comments too! Posted by: Dave Taylor at January 3, 2009 7:46 AMHello Thanks Posted by: Marisa at February 17, 2009 8:00 AMDave, As always a great post. I do have a question for you though. Is there anyway to insert our ebay campaign id from epn into the code? Posted by: Harland at March 22, 2009 6:15 AMHarland, I'm afraid I don't really know what you're talking about with eBay Campaign ID and EPN. Can you point me to a page that has a search engine that does what you want? Posted by: Dave Taylor at March 23, 2009 6:04 PMHi Dave, this is fantastic stuff! I would like to know if it is possible to add a hidden word to the search so that when a user clicks the search button, this word is added to what the user put in? Hope that makes sense! Thanks very much in advance. Posted by: Jody at April 6, 2009 12:55 PMMight you point me to someone to code a script to search eBay completed listings using specific criteria, and export the results to XLS? iMacros hang up repeatedly. Thnx. Ian Posted by: Ian at July 14, 2009 1:04 PMI have a lot to say, but ...
I do have a comment, now that you mention it!
|
![]()
Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Industry News and Trade Shows Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Book Links
|