How to add OpenSearch support to your shopping cart
Posted 30 November, 2009 by qetzal. Posted in How to
OpenSearch is a collection of simple formats to share search results and discovery of search engines.
It allows accessing search engines directly from search boxes in some browsers: Internet Explorer, Firefox and Google Chrome.
In this post we will describe how to add OpenSearch support to your Ecwid shopping cart. So your customers will be able to search your products right from their browsers’ search boxes.
1. Create an opensearch.xml text file with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Store Name</ShortName>
<Description>Description</Description>
<Url type="text/html" template="STORE_URL#ecwid:keywords={searchTerms}&mode=search&offset=0&sort=relevance"/>
</OpenSearchDescription>
where
Store Name is your store name.
Description is the description of your store and site.
STORE_URL is the URL of the page where your Ecwid store is installed. For example ‘http://example.com/store.html’.
Example of an XML file:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>My Cool Store</ShortName>
<Description>We sell cool products.</Description>
<Url type="text/html" template="http://example.com/store.html
#ecwid:keywords={searchTerms}&mode=search&offset=0&sort=relevance"/>
</OpenSearchDescription>
2. Upload this file to the root web directory of your site. Usually it’s ‘httpdocs‘ or ‘htdocs‘ or ‘public_html‘ directory.
3. Add the following line to each page of your site between tags <head> and </head>:
<link rel=search href="SITE_URL/opensearch.xml" title="Your_Store_Search" type="application/opensearchdescription+xml">
You should replace SITE_URL with your site domain (with the http:// prefix) and Your_Store_Search with the name of your store search or the name of your site.
E.g.:
<link rel=search href="http://example.com/opensearch.xml" title="Cool Store Search" type="application/opensearchdescription+xml">
That’s all. If you have any questions, feel free to ask on our forums.

Good stuff
Thank you!