Contributions
AJAX Search Suggest
This package is a replacement for the default search.php infobox that adds AJAX search suggest functionality similar to Google Suggest.
Installation involves replacing the search.php infobox, adding 1 file, and adding 3 new styles to the stylesheet.
For updates and more detailed information visit:
http://www.oscommerce-ssl.com/en/AJAX_Search_Suggest.html
For a detailed tutorial on how the AJAX functionality works visit:
http://www.dynamicajax.com/fr/AJAX_Suggest_Backend-271_290_312_315.html
Expand All / Collapse All
It's Autocomplete ajax for osCommerce with iso-8859-2 for some shops like osCommerce Pro 1.03PL
Thanks for atention.
This update tells the customer if no quick result is found, and gives them a link to click that takes them to the normal search page's results. This is based on the full package uploaded by dsonnet on the 6th of May. Install that, then replace searchsuggest.php with this one.
*** NOT A FULL PACKAGE ***
it's important to activate register_globals! otherwise the user will be logged out after each search request...
NO FILE UPLOADED
It has come to my attention that an autocomplete form will display on top of the ajax search results making it so that some product titles can't be seen. Add this attribute to your input field Keywords
autocomplete="off"
<input type="text" name="keywords" id="txtSearch" autocomplete="off"/>
attachment is not the full package
I wanted to use the AJAX Search Suggest in the header of my site and it was real easy...ultimately.
Version 1.6 had a typo error in the javascript (requestintance vs requestinstance)
The sql is also optimised to return only the needed fields, on a server with a lot of search queries it reduces significantly the loand on the mysql server (2 fields passed insteand of the full joint)
now it's more flexible for everyone.
i created a small JS class and divided the data and layout by xml and xslt.
the solution with german or other special chars, i encode the output with utf8.
PS: if someone have found a mistakes in my text, you could have taken it self :D
If you like to get the links suggestion inside your side box, just modify absolute to relatvie in the css file as :
/*----------------------------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: relative; //absolute;
background-color: #330099 //#FFFFFF;
text-align: left;
border: 0px solid #330099 //#000000;
}
/*----------------------------End Suggest Styles------------------------*/
see how it happens in my site www.e-modelisme.com
Problem bei deutschen Umlauten behoben.
searchsuggest.php angepasst.
This contribution is an update version of AJAX Search Suggest ver.1.4 by Maverick,
where a bug was detected when you begin to write in the textbox search field and
if you delete all letters previous writen you noticed that the div did not closed.
All the products continued to be shown.
This is just a correction and is not the full package.
***BACKUP YOUR FILES***
$query = tep_db_query("select pd.products_id,
pd.products_name,
p.products_tax_class_id,
p.products_price,
p.products_model,
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price
from " . TABLE_PRODUCTS_DESCRIPTION . "
pd left join " . TABLE_PRODUCTS . " p
on (p.products_id = pd.products_id) left join specials s on p.products_id = s.products_id
where (pd.products_name like '%" . tep_db_input($q) . "%'
or p.products_model like '%" . tep_db_input($q) . "%' or p.products_words like '%" . tep_db_input($q) . "%' or pd.products_description like '%" . tep_db_input($q) . "%' )
and p.products_status = '1'
and pd.language_id = '" . (int)$languages_id . "'
order by pd.products_name asc limit " . $limit);
/////////////////
$query = tep_db_query("select pd.products_id,
pd.products_name,
p.products_tax_class_id,
p.products_price,
p.products_model,
IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price
from specials s, " . TABLE_PRODUCTS_DESCRIPTION . "
pd left join " . TABLE_PRODUCTS . " p
on (p.products_id = pd.products_id)
where (pd.products_name like '%" . tep_db_input($q) . "%'
or p.products_model like '%" . tep_db_input($q) . "%' or p.products_words like '%" . tep_db_input($q) . "%')
and p.products_status = '1'
and pd.language_id = '" . (int)$languages_id . "'
and p.products_id = s.products_id
order by pd.products_name asc limit " . $limit);
// EOF hide products from group
if ( tep_db_num_rows($query) ) {
while ( $row = tep_db_fetch_array($query) ) {
if (tep_not_null($row['specials_new_products_price'])) {
$price = ' <s>' . $currencies->display_price($row['products_price'], tep_get_tax_rate($row['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($row['products_tax_class_id'])) . '</span>';
} else {
$price = ' ' . $currencies->display_price($row['products_price'], tep_get_tax_rate($row['products_tax_class_id'])) . ' ';
}
$name = $row['products_name'];
$id = $row['products_id'];
$url = tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $id);
$results[] = '<a href="' . $url . '">' . $name . '</a>' . $price. "n";
//////////////////////////////////////
AJAX Search Suggest ver.1.4 by Maverick
New sql request using tables filenames to avoid any problems in case of table prefix...
Multilanguage sort added by: pd.language_id = '" . (int)$languages_id . "', very usefull for multilanguage shops...
Enjoy...
;o)
I've merged the last two contribution, now the Ajax Search Suggest will search only for active products and will make a link for the mini search results...
U can see it working on my store http://www.drako.it/
All the credit goes to the original autor of this nice and usefoul contribution.
Made a few minor updates:
* Rename the filename SearchSuggest.php to lower case and the call method too. Some ftp tool are automatically change to lowercase upon upload
* Add the check for product status on search, exclude inactive ones.
This modified SearchSuggest.php will create a clickable link for each product listed in the suggestions. Just replace SearchSuggest.php.
this a very good comtrib, but it does not seem to work on ie .
But it is not for the pb mentioned : but just this :
change :
var str = escape(document.getElementById('txtSearch').value);
by:
var str = escape(document.quick_find.txtSearch.value);
document.getElementById('txtSearch').value = value;
by:
document.quick_find.txtSearch.value = value;
You can also add the language filter in the sql query :
WHERE language_id = '" . (int)$languages_id . "' and ...
bye ;)
This is a new package with a capitalization error bug fix.
This package is a replacement for the default search.php infobox that adds AJAX search suggest functionality similar to Google Suggest.
Installation involves replacing the search.php infobox, adding 1 file, and adding 3 new styles to the stylesheet.
For updates and more detailed information visit:
http://www.oscommerce-ssl.com/en/AJAX_Search_Suggest.html
For a detailed tutorial on how the AJAX functionality works visit:
http://www.dynamicajax.com/fr/AJAX_Suggest_Backend-271_290_312_315.html
Note: Contributions are used at own risk.