Home  |  Tips  |  Contributions  |  SEO  |  Backend  |  Templates  |  Packages  |  SSL
AJAX Search Suggest for osCommerce
The AJAX Search Suggest for osCommerce is a contribution that I have started over the past week.  This is based on my AJAX Suggest Tutorial that I worte a little while back.  The code is pretty basic and could easily be expanded upon which I plan to do in the future.

The AJAX Search Suggest replace the standard osCommerce search box with one that will automatically suggest products from the MySQL database as the user types in their keyword search criteria.

How this works is we make asyncronous XmlHttpRequest 's to a new backend page that returns a list of results from the products_description table. 

Installation is pretty simple. I mainly consists of replacing the search info box file, adding the search suggest backend file, and adding three styles to the style sheet. Even though it is a real simple install, there is always the possibility of skrewing something up, so I must remind you to BACK UP YOUR FILES BEFORE YOU INSTALL THIS CONTRIB!. If you skrew up your store, I cannot be held responsible.

Instructions:

Download The osCommerce AJAX Search Suggest package

Step one: Add the following styles to "StyleSheet.css". You can add these styles anywhere in the file. I just placed them at the bottom.

/*----------------------------Suggest Styles--------------------------*/
.suggest_link {
background-color: #FFFFFF;
padding: 2px 6px 2px 6px;
}
.suggest_link_over {
background-color: #3366CC;
padding: 2px 6px 2px 6px;
}
#search_suggest {
position: absolute;
background-color: #FFFFFF;
text-align: left;
border: 1px solid #000000;
}
/*----------------------------End Suggest Styles------------------------*/

Step two: Add the file "SearchSuggest.php" to the root of your site.

Step three: Replace "search.php" located at "/includes/boxes/search.php" with the "search.php" file provided.

That's it, you should be ready to go with the search suggest on your site. If you have any problems, write me at: ryan@oscommerce-ssl.com and I will try and get back to you as time permits.

Enjoy!