|
Alex
|
 |
« on: January 20, 2007, 10:58:46 PM » |
|
This small contribution will add a nice pop-out Google Suggest like box to your usual search box of your OsCommerce store. Why should you use our ‘Search suggest’ feature among others? - Search is performed while customer types in the product using first letters - The customers typing will be ‘auto-completed’ with symbols of the first founded occurrence - The first found letter occurrences will be highlighted with bold - The dropdown pop-out is scrollable but only if search match exceeds the pop-out window - Key recognition is available, press up, down or ‘enter’ inside the suggest dropdown - Multi language support - Works in all modern browsers Checkout the products page for details Ajax Search Suggest for OsCommerce
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Alex
|
 |
« Reply #2 on: January 27, 2009, 01:54:59 AM » |
|
Hello, Yes, I think its possible. You need to change the XML format a bit of the returned data in suggest.php, and add the URL you need to go to the xml returned. In some field, e.g. '<url>'.tep_href_link(FILENAME_PRODUCT_INFO,'products_id='.$row['products_id'],'NONSSL',false,false).'</url>' (note that you should also add this field to a select query) and then just use it in javascript handler (search.php), where we have a phpHelpUrl variable which denotes where to go... just find a way to get the new URL xml result just as we get the name, and use it in function displayResults(keyword, results_array) somehow. Hope that helps..
|
|
|
|
|
Logged
|
|
|
|
|
luigi_77
|
 |
« Reply #3 on: January 29, 2009, 06:14:19 AM » |
|
Many thank's for reply ALEX !! but i don't understood well the changes to do. I'm not good with the changes PHP languages. Please if a send you the file suggest.php and search.php please if possible modify ? If I must pay something also tells me. Help me please !!! Idea !! I post my file php and you give me the modify need. my file suggest.php <?php
require('includes/application_top.php');
function getSuggestions($keyword) { global $languages_id; // escape the keyword string $patterns = array('/\s+/', '/"+/', '/%+/'); $replace = array(''); $keyword = preg_replace($patterns, $replace, $keyword); $keyword = tep_db_input($keyword); // build the SQL query that gets the matching functions from the database if($keyword != '') $query = 'SELECT products_name ' . 'FROM products_description ' . 'WHERE products_name LIKE "' . $keyword . '%" and language_id = "'.$languages_id.'"'; // if the keyword is empty build a SQL query that will return no results else $query = 'SELECT products_name ' . 'FROM products_description ' . 'WHERE products_name !="" and language_id = "'.$languages_id.'"'; // execute the SQL query $result = tep_db_query($query); // build the XML response $output = '<?xml version="1.0" encoding="'.CHARSET.'" standalone="yes"'.'?'.'>'; $output .= '<response>'; // if we have results, loop through them and add them to the output if(tep_db_num_rows($result)>0) while ($row = tep_db_fetch_array($result)) $output .= '<name>' . $row['products_name'] . '</name>'; // close the result stream // add the final closing tag $output .= '</response>'; // return the results return $output; }
// retrieve the keyword passed as parameter $keyword = $HTTP_GET_VARS['keyword']; // clear the output if(ob_get_length()) ob_clean(); // headers are sent to prevent browsers from caching header('Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header('Content-Type: text/xml'); // send the results to the client echo getSuggestions($keyword); ?> my file search.php (only line)
|
|
|
|
|
Logged
|
|
|
|
|
luigi_77
|
 |
« Reply #4 on: January 29, 2009, 06:16:17 AM » |
|
my file search.php is big than 200000 characters !! if possible send it email ?
|
|
|
|
|
Logged
|
|
|
|
|
venom54
|
 |
« Reply #5 on: February 02, 2009, 08:15:42 PM » |
|
Hi, Ive installed this contribution but it has a small bud in that it will not show results of the search in the drop down box. I've include a sample picture of the problem on a page with the said request. Any held will be great. 
|
|
|
|
|
Logged
|
|
|
|
|
Alex
|
 |
« Reply #6 on: February 03, 2009, 06:12:23 AM » |
|
Hi venom54,
This is pretty weird. Can you give us your URL where you have it installed so we can look at it? Anyway, the first step in checking it will be looking for an xml reply from suggest: http://<yourdomain>/suggest.php?keyword=<some keyword>
If it is empty, then something is wrong when searching..
|
|
|
|
|
Logged
|
|
|
|
|
luigi_77
|
 |
« Reply #7 on: February 03, 2009, 10:41:55 AM » |
|
my file search.php /* URL to the PHP page called for receiving suggestions for a keyword*/ var getFunctionsUrl = "suggest.php?keyword="; /* URL for seeing the results for the selected suggestion */ var phpHelpUrl="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT,'keywords=','NONSSL',false,false);?>"; but i need a link derectly at my prducts !!! I must change in this line? var phpHelpUrl="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT,'keywords=','NONSSL',false,false);?>";
|
|
|
|
|
Logged
|
|
|
|
|
Alex
|
 |
« Reply #8 on: February 03, 2009, 10:46:47 AM » |
|
No, that is not that easy. There're are more changes required in a lot more places.
P.S. You can always order few hours of our support if you need it asap.
|
|
|
|
|
Logged
|
|
|
|
|
luigi_77
|
 |
« Reply #9 on: February 03, 2009, 10:54:36 AM » |
|
Alex,
please make an estimate of the payment if you must make this personal change ?
|
|
|
|
|
Logged
|
|
|
|
|
venom54
|
 |
« Reply #10 on: February 03, 2009, 03:29:36 PM » |
|
|
|
|
|
|
Logged
|
|
|
|
|
Alex
|
 |
« Reply #11 on: February 04, 2009, 06:35:34 AM » |
|
Okay, the problem is in special characters in your product names... Solution is simple: in the `suggest.php` file, replace $output .= '<name>' . $row['products_name'] . '</name>'; with $output .= '<name>' . htmlentities($row['products_name'], ENT_QUOTES) . '</name>'; this should fix it. P.S. Others who have also problems with results in dropdown, use this quickhack..
|
|
|
|
|
Logged
|
|
|
|
|
luigi_77
|
 |
« Reply #12 on: February 04, 2009, 08:30:47 AM » |
|
Alex,
not possible help me ?
|
|
|
|
|
Logged
|
|
|
|
|
Alex
|
 |
« Reply #13 on: February 04, 2009, 11:20:07 AM » |
|
Hello luigi_77
Please write to our support through a contact us form.
|
|
|
|
|
Logged
|
|
|
|
|
|
|