Trigger when filtering is done

  • Posts: 217
  • Thank you received: 4
4 years 5 months ago #311553

-- HikaShop version -- : 4.2.3

Hello!

I would like to ask you for help. I need to trigger javascript after filtering is done. Please, could you advise me in what file on what line can I add my code?

I need to scroll up after filtering is done – I can manage this, I only need to know, where I can execute this code.


Thank you in advance many times!
Filip

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
4 years 5 months ago #311555

Hi,

There is a trigger filters.updated which you can use.

window.Oby.registerAjax("filters.updated",function(params){ 
....Your function here....
});

You can find more about this in this topic: www.hikashop.com/forum/filters-search/89...iltering.html#308760

Hope that helps.

Thans

The following user(s) said Thank You: nicolas, FilipHradil

Please Log in or Create an account to join the conversation.

  • Posts: 217
  • Thank you received: 4
4 years 5 months ago #311561

Thank you so much for advice! It works perfectly. I resolved my issue thanks to your solution.

If somebody needs to scroll up to 1st product after filtering (for example: if you have filters in sidebar as me), here is my code:

window.Oby.registerAjax("filters.updated",function(params){ 

	    jQuery('html, body').animate({
	        scrollTop: jQuery('.hikashop_products').offset().top
	    }, 1000, 'easeOutExpo' );

	});


Thank you, once again!
F.

The following user(s) said Thank You: kyratn

Please Log in or Create an account to join the conversation.

  • Posts: 81379
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #311560

Hi,

We actually have added an option to the filter module to do that for the next version of HikaShop which is to be released soon.
So I would recommend to wait for a few more days and just activate that.

Please Log in or Create an account to join the conversation.

  • Posts: 217
  • Thank you received: 4
4 years 5 months ago #311682

Thank you for information.

Have a nice day,
Filip

Please Log in or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum