Create a Split-Pane Search Tool

Replace eBay’s search page with a framed version that makes it easier to go through a large number of search results in a short time.

The JavaScript solution in “Open Search Results in a New Window” [Hack #16] works, but it does so by hacking into existing search results pages. A better solution is to use the API to create a custom search tool.

This hack uses frames to list search results and individual listings side-by side. First, set up your frames:

     <frameset cols="20%,80%" frameborder=no> 
		<frame src="http://your.server/cgi-bin/search.pl" name="search">			<frame src="http://my.ebay.com/ws/ebayISAPI.dll?MyeBay" name="listing">
     </frameset>

Save this into a file called framesearch.html.

The Code

Next, modify the search.pl script from “Search eBay Listings” [Hack #104] so that it spits out HTML instead of plain text, including a simple HTML search form:

 #!/usr/bin/perl require 'ebay.pl'; require 'cgi-lib.pl'; &ReadParse; $keywords = $in{'keywords'}; print "<html><body>"; print "<form action=\"http://your.server/cgi-bin/search.pl\">"; print "<input name=\"keywords\" value=\"$keywords\">\n"; print "<input type=\"submit\" value=\"Search\">\n"; print "</form>\n"; if ($keywords eq "") { exit; } print "<p><hr><p>\n"; print "<nobr>\n"; PAGE: while (1) { my $rsp = call_api({ Verb => 'GetSearchResults', DetailLevel => 0, Query => $keywords, SearchInDescription => $opt_d ? 1 : 0, Skip => $page_number * 100, }); if ($rsp->{Errors}) { print_error($rsp); last PAGE; ...

Get eBay Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.