Jump to content

Run Javascript Code after Layered Nav Block Call


oliiix

Recommended Posts

Hi

 

I have a little jquery snippet i'd like to run at page load. Thing is, it's not being run when I select a filter in the layered navigation block. I tried the solution found under following link:

 

https://www.prestashop.com/forums/topic/261175-solved-how-to-add-javascript-code-to-run-after-the-block-layered-is-done-loading/

 

I added my code inside blocklayered.js nearly everywhere for testing purposes, especially the locations where the forum post mentioned earlier specified (blocklayered.js:updateProductUrl()). But it's kinda not working :S

 

Here's the code that I'd like to run. It simply removes the first two numbers of each feature value which I used so the feature values are in the correct order. It works as long as one does not select any layered nav block filter:

var regex = /^[0-9][0-9] /;
    
$('div.layered_filter ul.layered_filter_ul label a').each(function() {
    if ($(this).html().match(regex)) {
        $(this).html($(this).html().slice(3));
    }
});

Thanks for trying to help ;)

Oli

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...