Ajax AutoComplete Support Product Page

In progress

Duplicate suggests in list

Reported 05 Jul 2012 10:49:31
1
has this problem
05 Jul 2012 10:49:31 Fabrice Gilbay posted:
Hello from Paris !
I had to add "DISTINCT' in the SQL query to avoid duplicate suggests !
I hope this helps someone.

Replies

Replied 05 Jul 2012 11:14:14
05 Jul 2012 11:14:14 Vulcho Vulev replied:
Hello Fabrice.

Can you explain your issue a little bit more detailed ?

Regards : Vulcho.
Replied 05 Jul 2012 12:35:34
05 Jul 2012 12:35:34 Fabrice Gilbay replied:
OK. I will try it :

I wanted to implement a field with Ajax AutoComplete to avoid multiple syntaxes of the same keyword.
The suggested list is from the same table.
So, necessarily, there are several records with the same keyword, and the suggested list returned by Ajax AutoComplete contains all the duplicates keywords.
So, I had to add "DISTINCT" in the SQL statement :

$sql = 'SELECT DISTINCT '.$fields.' FROM `'.$table.'`';

I hope this is more clear now.

Best regards.
Replied 06 Jul 2012 06:48:07
06 Jul 2012 06:48:07 Teodor Kuduschiev replied:
Hello,

This is how the Ajax Autocomplete is supposed to work.

Reply to this topic