Industry guru Dave Taylor offers free tech support on a wide variety of technical and business topics, including HTML, Apple iPhone, online advertising, Cascading Style Sheets, Web design, management, Unix, Linux, search engine optimization, online dating, Mac OS X, shell script programming and Microsoft Windows.

Add an eBay Search Box to Your Web Page

Dave, help, how I would go about adding an eBay search field to my homepage, one that I could enter a search term in and get the results popped up on the eBay website?


Dave's Answer:

First off, some background: How can I add a Google search box to my web site and How do I add a Technorati search box to my Web site?

Now that we've established the theme :-) let's look at how eBay structures queries. If you actually view the source to the eBay Web page, it's just about impossible to decipher how they do searches, actually, because of all the JavaScript they're using. Not sure why they need the complexity, but fortunately a bit of detective work can suss out the most important values, the field names and the CGI script or program on the server that receives search queries.

Boiling their form down to its bare essence, then:

<form method="get"
  action="http://search.ebay.com/search/search.dll">
<input type="hidden" name="sojs" value="1">
<input type="hidden" name="from" value="R40">
<input type="text" maxlength="300" name="satitle" size="20">
<input type="submit" value="Search">
</form>

Here's an example of it at work:

Experimentation reveals that you don't need to send either the sojs or the from fields either, so in fact the smallest possible eBay search box looks like this:

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

I'll leave all the fancy cleanup and design work to you, but those few lines of code should definitely get you moving in the right direction!



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

Subscribe!

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

Comments

Dave, you are officially a genius. Cheers mate!

Posted by: Dave at August 23, 2005 11:27 PM

Cheers Dave, I'm just creating my custom start page at http://www.protopage.com and this is just the ticket for my quick search box.

Posted by: Ross at November 11, 2005 11:24 PM

Hello,

I tried to cut and paste a few of your suggestions like "ask dave", the froogle, and the ebay search but some of the script shows up on the page. I copied exactly what you have listed and pasted into site designer. Do you have any suggestions? If all else fails I will paste your url. Thanks, your site is very informative!

Posted by: Elaine at March 20, 2007 2:13 PM

Elaine, the problem is probably because you're cutting and pasting into the "text input" mode in your page editor. Try looking in the help system to see if there's a "code" or "raw" or "html" view you can enable: then the code you cut and paste will be correctly included as HTML, rather than "fixed" as text.

Posted by: Dave Taylor at March 20, 2007 9:59 PM

Dave, I got the search box into my 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

Posted by: Will at October 29, 2007 1:50 PM

Got you covered, Will:

http://www.askdavetaylor.com/ebay_search_box_search_titles_descriptions.html

Posted by: Dave Taylor at November 27, 2007 10:56 AM

Thanks Dave this is great, but I was wondering if I could add my affiliate link to the search results. You can link to search results or any ebay page using this tool http://affiliates.ebay.com/ns/FlexTool.htm
So I was wondering if I could work this into the script. Thanks for any ideas.
Jesse

Posted by: Jesse at December 17, 2007 10:47 AM

Hi Dave

Can you add affiliate information to the results? Same question as Jessie.

Thank you Dave for the great information!!!


George
www.quickieclick.com

Posted by: George at December 22, 2007 10:52 AM

Is there a way to only searxh Buy it nows?

Great coding thanks!

Posted by: john at April 30, 2009 1:14 PM

Hi Dave

Great bit of info.

Is there any way that I can access my saved eBay searches?

Thanks

Posted by: AcmeUK at September 18, 2009 4:09 AM

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

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











Remember personal info?


Please note that I will never send you any unsolicited 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.








Ask Dave Taylor: The iPhone App: Advertisement



Follow me on Twitter @DaveTaylor

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!

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
Book Links
© 2002 - 2010 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]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.