PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

[SOLVED] Javascript autocomplete error with Quicksearch in Left Column

3 replies to this topic
#1
potski205

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
Hi,

I wonder if anybody can help. In Internet Explorer, I keep getting the 'done but with errors on page' javascript syntax error. Having already searched the forum for a solution, I did find out that this is due to a problem with the autocomplete not being found for the JavaScript search function and the fact that I have transplanted the quicksearch module to the left column from the header. It is not an option for me to put it back to the top of page as the design requires it be in the left column. I also tried the solution posted here:

http://www.prestasho...not_a_function_

but inserting this script into the header.tpl did not fix the error.

I would be really grateful if anybody could help me fix the Javascript error so I can keep the quicksearch in the left column and not have any errors appear in the IE.

I think this is the troublesome code (error line starred):

[removed]

function formatSearch(row) {
return row[2] + ' > ' + row[1];
}

function redirectSearch(event, data, formatted) {
$('#search_query').val(data[1]);
document.location.href = data[3];
}

$('document').ready( function() {
$("#search_query").autocomplete(
'/search.php', {
minChars: 3,
max:10,
width:500,
scroll: false,
formatItem:formatSearch,
******** extraParams:{ajaxSearch:1,id_lang:} *****************
}).result(redirectSearch)
});

[removed]



I am not very experienced with JavaScript or Prestashop so any help with fixing this would be much appreciated. Thanks in advance.

#2
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
There is a bug in the "v1.1 theme compatibility" that causes this problem. You need to add the following code after line 182 of init.php:


'cookie' => $cookie,

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#3
potski205

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
Thank you so much, it worked. This has been driving me crazy for ages so your help is very much appreciated.

#4
BillyD

    PrestaShop Newbie

  • Members
  • Pip
  • 9 posts

From 1265686946:

There is a bug in the "v1.1 theme compatibility" that causes this problem. You need to add the following code after line 182 of init.php:


'cookie' => $cookie,


I get this same error but only on my index page. I have added an extra hook to a top navbar that has a working search with autocomplete on all other pages.