• Resolved mohammedmalleck

    (@mohammedmalleck)


    Hi there ,
    I want to create a hierarchy sort of effect with the categories showing in the filter.
    I am giving categories classes on initial page load via JS code in functions.php , you can view it here

    The issue is the for obvious reasons the code does not get re-triggered when I filter products via Ajax filtering.

    Is there a way to trigger this code again?,

    ideally if there is an solution which gives each parent category, sub categories different classes for layout purposes that would be amazing.

    Looking forward to your response , ty 🙂

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support fesupportteam

    (@fesupportteam)

    Hi @mohammedmalleck

    Please check this documentation page: https://filtereverything.pro/resources/ajax-instructions-only/#ajax_related_problems it contains information for such cases, including what you can do to reinitialize your JS code.

    Specifically this part: https://prnt.sc/MRS_WuPa0sZQ

    Best Regards,
    Victor

    Thread Starter mohammedmalleck

    (@mohammedmalleck)

    Unfortunately , I tried this but it seems like the code is not reinitialize on Ajax filtering

    Plugin Support fesupportteam

    (@fesupportteam)

    Before testing your custom code, start with a simple JavaScript snippet that just displays some text. Make sure that the text appears inside the container that gets updated via AJAX during filtering. Then, perform filtering. If the text disappears, it confirms that the container is being replaced by AJAX.

    Next, use the wrapper provided in the documentation and place your test JS code inside it. Test again, the text should now persist after filtering.

    Once confirmed, replace the test code with your custom code. Test it the same way, and make sure any required PHP parts are also running as expected. Keep in mind that PHP code only runs once on initial page load and does not re-run during AJAX updates triggered by your custom JS.

    Best Regards,
    Victor

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Run Js Code After Ajax Filtering’ is closed to new replies.