Quick view does not work after applying a filter

  • O-O
    Participant
    4 years, 9 months ago #17542

    Hello,

    There are some issues with using quickview after applying a filter or using a product category. Before using anything quickview quickly opens.
    https://ibb.co/6mb2H69
    But after applying the product category shirts and tops, the quick view does not appear to work.
    https://ibb.co/D4hdwH1
    Could you please help us?

    Thank you for your time and help

    wpsolr
    Keymaster
    4 years, 9 months ago #17545

    This is a classic Ajax side effect.

    Your Quickview is a javascript code (probably jQuery) that listen to button click events to open the popup.

    When you click on a facet, the whole results html is removed and recreated. But the Quickview code is not aware of that, and is still listening to the old results events.

    There are 2 solutions to solve this Ajax refresh problem:
    a) Prevent the use of Ajax in the WPSOLR “Theme” add-on: the whole page will be reloaded, including the Quickview js code.
    b) When the Ajax refresh is completed, call the Quickview library code and ask it to init again. WPSOLR is emitting a javascript event after the Ajax refresh, that your own javascript code can trigger to call the Quickview init code.

    // In WPSOLR code : notify that Ajax is completed
    jQuery(document).trigger('wpsolr_on_ajax_success');
    // In your javascript code: custom event to reinit the QuickView after Ajax
    $(document).on('wpsolr_on_ajax_success', function (event) {
      // Here, reinit the QuickView object     
    });
    O-O
    Participant
    4 years, 9 months ago #17550

    We think option b is the best for us, but we are not entirely sure where we have to place this code.

    wpsolr
    Keymaster
    4 years, 9 months ago #17551

    You can:

    1) Inject your javascript code in your child theme’s functions.php code as seen in https://www.wpexplorer.com/javascript-wordpress/

    2) Create a small plugin that will do the same

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.