Jump to content

[1.7] Run Javascript on Facet filter update?


Recommended Posts


I'm trying to make the countdown for special price on PS1.7.2 in Classic theme.

Everything works fine except Facet filter pages (which is expected :) ).

Before facet filter use


The countdown works in every page except you use Facet filter.


After facet filter use


I didn't find anything related to facet filter update or page reload in javascript.

So how do I run my countdown after facet filter reloads page?


Link to comment
Share on other sites

We haven't an idea how exactely to have implemented your countdown. And it's difficult to debug your screenshots. From a guess I would say your javascript isn't loaded or not fired anymore after faceted filter has been used.

Well, it's obvious :)

I've found the workaround, but it seems to me a bit lame.

In /classic/_dev/js/listing.js 

add the code, which fires countdown after facets filter used (and of course compile it with Webpack afterwards):

function updateProductListDOM (data) {

  let productMinitature = new ProductMinitature();
// The code below fires the countdown
    $('[data-countdown]').each(function() {
      var $this = $(this), finalDate = $(this).data('countdown');
      $this.countdown(finalDate, function(event) {


I'd like to make more elegant solution. For example save this function to object and call it with one string, or something better, but my JS skills are as lame as the code I've posted above :)

So, If you know how to solve this, please help :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...