Jump to content

Animated gif displaying when search function is searching suggestions.


Recommended Posts

Hi,

 

I would like to add some animated gif icon into search field, so when visitor types something to search for in the field it gives him this icon until search display some results or suggestions.

 

Something like this:

 

http://www.google.com/imgres?imgurl=http%3A%2F%2Fwww.pall.com%2Fimages%2Fcss_img%2Floading.gif&imgrefurl=http%3A%2F%2Fwww.pall.com%2F&docid=RDT1BX94HwTQTM&tbnid=NP-2wayMbahCGM&w=100&h=100&ei=yeOVUYu6McSt4AT1zoEY&ved=0CAkQxiAwBw&iact=ricl

 

Here is the screenshot of my website search function and some further explanation:

 

 

 

Ty in advance.

Dean

post-525426-0-32766200-1368777777_thumb.png

Link to comment
Share on other sites

okay

 

so you have to edit two files:

  • blocksearch-top.tpl located in search module dir (blocksearch).

open this file and add code i pasted below. Put it for example, right after the: <div id="search_block_top">

<div style="display:none; width:32px; height:32px; background:url('http://www.museek.pl/music/design/templates/bluetheme/root/images/screen_blue/loader.gif')" id="ajaxsearchloader"></div>

 

this is a loadnig image, dont forget to use own image (now it is linked to other website)

 

save changes and open another file:

  • blocksearch-instantsearch.tpl located in search module dir (blocksearch).

after:

$("#search_query_{$blocksearch_type}").keyup(function(){

add:

$("#ajaxsearchloader").show();

 

and after:

type: 'POST',
success: function(data){

 

add:

 

$("#ajaxsearchloader").hide();

  • Like 1
Link to comment
Share on other sites

Ty for the instructions but in the module dir (blocksearch) there is no file blocksearch-top.tpl only blocksearch.tpl

 

Sry for my ignorance. I was searching within theme dir.

I found it, thank you.

 

I will apply these changes and let you know if this works.

Edited by Dolke (see edit history)
Link to comment
Share on other sites

Ty for the instructions but in the module dir (blocksearch) there is no file blocksearch-top.tpl only blocksearch.tpl

 

Sry for my ignorance. I was searching within theme dir.

I found it, thank you.

 

I will apply these changes and let you know if this works.

 

okay, im waiting for your reply :-) for me it works like a charm ;)

Link to comment
Share on other sites

you have to change the styles for this block with image.

 

add position:absolute; left:-40px;

 

<div style="position:absolute; left:-40px; display:none; width:32px; height:32px; background:url('http://www.museek.pl/music/design/templates/bluetheme/root/images/screen_blue/loader.gif')" id="ajaxsearchloader"></div>

 

effect:

 

TyM9o9X.png

Link to comment
Share on other sites

Nice! Bravo Vekia, you are one of my fav PrestaShop players around here thats for sure :)

 

I think I will make this gif image a bit bigger, 45x45 :)

 

I noticed one bug though.

 

When you go to the home page, you type something in the search field gif appears After it give me some suggestions are results gif goes away. So far so good. But, then i delete all characters from the search field and gif is showing again, but it wont go away.

 

Is there a way to solve this as well?

 

I think this is the last step to mark this thread as solved.

 

Dean

Link to comment
Share on other sites

in the blocksearch-instantsearch.tpl file you've got:

 

function tryToCloseInstantSearch() {
  if ($('#old_center_column').length > 0)
  {
   $('#center_column').remove();
   $('#old_center_column').attr('id', 'center_column');
   $('#center_column').show();
   return false;
  }
 }

 

add the:

 

$("#ajaxsearchloader").hide();

 

 

 

function tryToCloseInstantSearch() {
  $("#ajaxsearchloader").hide();
  if ($('#old_center_column').length > 0)
  {
   $('#center_column').remove();
   $('#old_center_column').attr('id', 'center_column');
   $('#center_column').show();
   return false;
  }
 }

 

 

can you try with this?

Link to comment
Share on other sites

  • 11 months later...

I saw a class ac_loading in prestashop1.25/css/jquery.autocomplete.css.

 

But how to use it to obtain this effect for ajax search autocomplete tooltip?

 

Thank's a  lot

 

 

Edit:

I had a background image in the input tag. I deleted it and applied the class ac_loading on this input.

It's work.

Edited by caromax (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...