Advance software forum
February 04, 2012, 02:24:02 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Ajax Search Suggest - canīt download - mods  (Read 1019 times)
0 Members and 1 Guest are viewing this topic.
bugnet
Newbie
*
Offline Offline

Posts: 2


View Profile
« on: April 22, 2009, 12:01:54 PM »

Hi there,
I was trying to download Ajax Search Suggest actual version from http://www.advancewebsoft.com/solutions/oscommerce/oscommerce-contributions/ajax-search-suggest-for-oscommerce-p.html

but I get nothing more than an empty .zip file, what am I doing wrong ?

other, I was wondering a mod, trying to change some way Ajax search suggest works, instead of searching for keyword%, search as %keyword% since many products where listed starting with manufacturers name, and major situations customers type stuff to search within the title, not only the start of it, and for this we need to suggest start ignoring less than (an idea) 4 characters typen (or will get lots and lots of suggests and loads before it), Iīve tried that on Js of handleKeyup(e) function without any success, Js seens to ignore even when I put some condition for the rest of script to run like this
Code:
var keylen = document.getElementById("keyword").value.length;
 if(keylen >= 5) {

any help here ?
thanks,
David
Logged
Alex
Administrator
Full Member
*****
Offline Offline

Posts: 128


View Profile
« Reply #1 on: April 23, 2009, 06:12:32 AM »

Hello bugnet,

The download works fine, we've checked everything.

As for the mod, the term "suggest" actually means that mod will suggest the next few words of your search term, not the pre-words.
Google did suggestions first, look how they are working with it. Finally, if you still wish to do such a mod (let us call it not a suggest, but a simple search I guess then), you need to turn off the auto-complete feature (as it has almost no sense in this case) and modify the script to show
search results properly. The code is open, you can modify it as long as you need, go ahead and try.

If you succeed, post up the demo here, everyone will be glad to look at the results.
Logged
bugnet
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #2 on: April 24, 2009, 07:14:44 AM »

I still canīt download actual version, got only an empty file Sad

anyway I done my homework, was trying to do that on HandleKeyup function, but it should be on getSuggestions function, like that

search.php
Code:
function getSuggestions(keyword)

 if(document.getElementById("keyword").value.length > 5) {
  /* continue if keyword isn't null and the last pressed key wasn't up or
....

and a bracket downthere before function end bracket ( } )


another changes done to become more Oscommerce standard compatable, to get ONLY ACTIVE products (to avoid getting some unactive, and samples that I have on admin side but not on website) and to search within the title on suggest.php, around line 14 change to
Quote
...
    if($keyword != '')
      $query = 'SELECT pd.products_name, pd.products_id, pd.language_id, p.products_id, p.products_status ' .
               'FROM ' . TABLE_PRODUCTS_DESCRIPTION . ' pd INNER JOIN ' . TABLE_PRODUCTS . ' p ON p.products_id = pd.products_id ' .
               'WHERE pd.products_name LIKE "%' . $keyword . '%" and pd.language_id = "'.$languages_id.'" and p.products_status = 1';
    // if the keyword is empty build a SQL query that will return no results
...
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!