Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

AJAX Quick Search


assembler

Recommended Posts

This is the support thread for the AJAX Quick Search Contribution.

 

http://www.oscommerce.com/community/contributions,3413

 

This contribution adds an AJAX Quick Search to your advanced search page. It could easily be adapted to any search box and any query in osCommerce.

 

This works basically the same way as Google Suggest. As you type, it guesses what you are typing and displays the product names below the search box. This works in real time, with no need to reload the page.

Link to comment
Share on other sites

This is the support thread for the AJAX Quick Search Contribution.

 

http://www.oscommerce.com/community/contributions,3413

 

This contribution adds an AJAX Quick Search to your advanced search page. It could easily be adapted to any search box and any query in osCommerce.

 

This works basically the same way as Google Suggest. As you type, it guesses what you are typing and displays the product names below the search box. This works in real time, with no need to reload the page.

Hi,

 

I've just instaled this contribution. Unfortunately, it doesn't work for me. When I start typing, nothing appears.

 

Any guesses? :blush:

Thanks,

Irina.

Link to comment
Share on other sites

Hi,

 

I've just instaled this contribution. Unfortunately, it doesn't work for me. When I start typing, nothing appears.

 

Any guesses? :blush:

Thanks,

Irina.

 

 

Great contribution! I'm also having problems, though. I'm not an AJAX expert by any stretch so I just wanted to throw my observations out there to help diagnose the problem.

 

Locally, on Win XP/Firefox and IE, the contribution works just fine. Remotely, on my Linux server, it doesn't. Could this be an OS-related problem?

 

Thanks!

Link to comment
Share on other sites

Locally, on Win XP/Firefox and IE, the contribution works just fine.  Remotely, on my Linux server, it doesn't.  Could this be an OS-related problem?

 

It looks like most browsers don't like the full URL that tep_href_link was producing. I uploaded a new package that fixes the problems. I have tested the new package on a remote LINUX server and it worked successfully. I have changed most of the Javascript to work with more browsers.

 

Instead of using the output of tep_href_link, I am now creating the link with

var url="quickfind.php?osCsid=<?php echo tep_session_id();?>&keywords="+key;

 

This is not the only change, so please download the new package.

http://www.oscommerce.com/community/contributions,3413

Link to comment
Share on other sites

It looks like most browsers don't like the full URL that tep_href_link was producing.  I uploaded a new package that fixes the problems.  I have tested the new package on a remote LINUX server and it worked successfully.  I have changed most of the Javascript to work with more browsers.

 

Instead of using the output of tep_href_link, I am now creating the link with

var url="quickfind.php?osCsid=<?php echo tep_session_id();?>&keywords="+key;

 

This is not the only change, so please download the new package.

http://www.oscommerce.com/community/contributions,3413

 

 

Works great now. Thanks for much!

Link to comment
Share on other sites

Hello,

 

On Firefox this contrib works great but on IE6 I have error on page:

 

line: 61

character: 4

 

"Can't move focus for format because he is invisible, off or his type don't accept focus. "

 

In my advanced_search.php 61 line start:

 

function getObject(name) { 
? var ns4 = (document.layers) ? true : false; 
? var w3c = (document.getElementById) ? true : false; 
? var ie4 = (document.all) ? true : false; 

? if (ns4) return eval('document.' + name); 
? if (w3c) return document.getElementById(name); 
? if (ie4) return eval('document.all.' + name); 
? return false; 
}

 

 

BTW. Contrib works on IE6 but I have error.

 

 

------------EDITED--------------

 

I change:

 

window.onload = function() { 
  getObject("keywords").focus();
}

 

to:

 

window.onload = function() { 
  getObject("keywords");
}

 

Now error missing and contrib work fine.

 

Regards.

Edited by nisarek
Link to comment
Share on other sites

Assembler thanks for this contribution.

 

I have a problem. I need to able to use '/' in the search box. As soon as I type / and a letter (or number) after /, it clears the results. This site is uses tire sizes so it is crucial to have / .

 

any idea to fix this,

 

here is the link to the search page:

AJAX quick search

 

Thank you,

OnuR

Link to comment
Share on other sites

Assembler thanks for this contribution.

 

I have a problem. I need to able to use '/' in the search box. As soon as I type / and a letter (or number) after /, it clears the results.  This site is uses tire sizes so it is crucial to have / .

 

any idea to fix this,

 

here is the link to the search page:

AJAX quick search

 

Thank you,

OnuR

 

Open quickfind.php. The line that is taking out the slash is line:

$q = addslashes(preg_replace("%[^0-9a-zA-Z ]%","",$_GET["keywords"]));

 

Change this line to allow for the '/'.

Link to comment
Share on other sites

Open quickfind.php.  The line that is taking out the slash is line:

$q = addslashes(preg_replace("%[^0-9a-zA-Z ]%","",$_GET["keywords"]));

 

Change this line to allow for the '/'.

 

thanks, now looks great, here is the changed line, may be somebody needs in the future

$q = addslashes(preg_replace("%[^0-9a-zA-Z/ ]%", "", $_GET['keywords']) );

Link to comment
Share on other sites

  • 2 weeks later...

What a great contribution!

 

I installed the version with the bugs fixes. ? It works fine when I run a search locally (my own pc acting as the server) but when I upload it the host of my website, it doesn?t run as it should ? just wont bring-up any of my products in the quick-find box.

 

Could this be something to do with my host?

 

Gareth

Link to comment
Share on other sites

  • 1 month later...
Could this be something to do with my host?

 

 

I re-did my code as per the contribution - the advanced search using ajax works fine when viewing on my localhost (my pc) but when it is uploaded and I try a search on my live site it wont work - could this be my host's settings? My website is hoted on a shared server.

 

Thanks

Link to comment
Share on other sites

  • 2 months later...

I was changed SQL string for searching in description of products, and yet i don't have right encoding. I was tried change encoding for database. default database settings:

 MySQL charset:  UTF-8 Unicode (utf8)
MySQL connection collation: utf_8_general_ci

 

encoding of input file in csv format i have windows-1250, encoding of page i have windows-1250 ...in shop is no problem, only with this nice( :thumbsup: ) ajax contribution. oscommerce have in some place character set for connection with database?

Link to comment
Share on other sites

@Assembler

 

I made some changes in the search algorithm so it searches for the first letters in the words seperated by spaces.

 

f?.

 

In the standandaard osc db

 

[a] or [a b] or [a b l]

 

gives A Bug's Life

 

but

 

[a b e] or [ab] doesn't but [a b ;] does again.

 

Futhermore i have made a version voor the standaard search box.

 

You can test it on http://www.watersport.mine.nu

 

If you want i can provide you with the sources so you can update your contribution.

 

Rgds,

 

Joop.

Link to comment
Share on other sites

  • 1 month later...

I have just installed AJAX Quick Search.

 

Just a few questions.

 

Is there a way to make keywords lead to other products.

 

----------------------------

Example: A Bug's Life

 

You start typing: A Bug AJAX Quick Search Finds: A Bug's Life

 

Is there a way to add such keywords as Children Movies / Kids Movies and make A Bug's Life comes up?

----------------------------

 

I use oscommerce for a vitamins store. most of my customers know what they want, but there is a select few that would search for common terms such as Flu, Colds, Inflammation, MultiVitamins, so on... anyone who types this gets nothing. Is there something I can do, our can someone point me in the right direction?

 

Thank you

Link to comment
Share on other sites

  • 1 month later...
Open quickfind.php. The line that is taking out the slash is line:

CODE$q = addslashes(preg_replace("%[^0-9a-zA-Z ]%","",$_GET["keywords"]));

 

Change this line to allow for the '/'.

 

my model contains the minus exemple : 1810-10-45

 

is there any way to add the minus since it seems to be used for range like a-z ?

 

the 1810-10-45 is found wich the original advanced search !

MS2

Link to comment
Share on other sites

Futhermore i have made a version voor the standaard search box.

 

You can test it on http://www.watersport.mine.nu

 

If you want i can provide you with the sources so you can update your contribution.

 

cool to have it in the normal boxes also but what is the aim o f :

 

ALTER TABLE products ADD FULLTEXT (products_model);
ALTER TABLE products_description ADD FULLTEXT (products_name);

?

MS2

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...