I read your note about how to add an Amazon.com search box to your site and it’s very cool, but what I want to know is: What if I want the search to only search a certain keyword, Example “Honda Parts”?
Of all the major sites that I visit with frequency, there are non with a more Byzantine URL structure and organization than Amazon.com. I don’t know what kind of back-end infrastructure decision they made years ago, but the whole “obidos” and session number thing really makes it a huge pain to work with the site, and forget about being able to email someone a URL so they can see a product for sale: their URLs are famously bizarre.
But! Don’t panic!
When it comes to their search system, buried in all the junk, there is a parameter that contains the actual search string, so when I go to Amazon.com and simply search for “honda parts” from the home page, the resultant page has the following URL:
Now it’s just a matter of slicing until it fails: what parameters can we axe from this ghastly URL until we get just what we want?
The way I do this is to actually edit the URL within the Address box of my browser (Apple’s Safari) and reload the page each time until it just doesn’t bring up what I seek.
Do that and you’ll quickly find that all the “Go” fields can be safely chopped off. Can we delete the url=search-alias%3Daps value?
Clearly not. We’ve ended up with a search that has no category specified, but the Amazon backend can’t extrapolate a full-site search. Bummer.
How about the core URL? Can we tweak that a bit, losing the nb_ss_gw and/or the 102-1882688 jazz?
Surprisingly, yes, you can get rid of the numeric session ID value without breaking the search, something that’s a bit confusing if you’re used to all parameters being name=value pairs after the “?” symbol. You can even get rid of the ref= part of the URL, believe it or not. Lots of superfluous information in this search URL, as is obvious.
Heck, you can even get rid of the “first-search” value, leaving us with a much less scary URL:
Doesn’t even need a line break. Better, you can now see how to add it to your site and how to use it as the wrapper for a button, say:
src=”amazon-search-honda.jpg” alt=”Search for Honda parts at Amazon” /></a>
or just as a hypertext link unto itself:
Hope that helps you work with the Amazon search engine!