Pagination not working on search results

1 reply2 participantsUpdated by Andrew Mitchell

  • Avatar: Enmanuel_Rostran
    Enmanuel Rostran
    Participant

    Hello XStore Support Team,

    I hope you’re doing well.

    I recently had an open ticket where your team (Jack Richardson) installed all the latest XStore patches on my website to fix an issue related to product visibility on search and shop pages.
    Here is the last message from the previous ticket for context:

    “Please check now. We have installed all the latest patches.”
    — Jack Richardson, 8Theme Team

    The initial issue was resolved — products now display correctly on search results and shop pages.

    However, I discovered a new problem: Pagination is not working

    When I try to navigate to page 2 (or any other page) in the product search results, nothing happens. The page stays on page 1.

    Additionally:

    When I try to manually visit a deeper page, like page 16, the layout breaks.

    The product grid loads incorrectly (images stretched, products misaligned, broken structure).

    The pagination links visually respond, but the content does not change.

    This happens only in the search results pagination.
    The issue was not noticed earlier because the previous problem prevented any results from showing.

    Please, contact administrator
    for this information.
    Files is visible for topic creator and
    support staff only.

    1 Answer

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff

    Hello, Enmanuel,

    Thank you for providing access. We have resolved the issue by adding the following file to your child theme:
    xstore-child/js/fix-ampersant.js
    with the corresponding code.

    jQuery(function($){
    
        function fixAmpersands(context){
            $(context).find('.page-numbers a, a.page-numbers, .woocommerce-pagination a')
                .each(function () {
                    let href = $(this).attr('href');
                    if(href){
                        href = href.replace(/#038;/g, '&').replace(/&/g, '&');
                        $(this).attr('href', href);
                    }
                });
        }
    
        fixAmpersands(document);
    
        $(document).on('elementor/popup/show elementor/popup/hide elementor/frontend/init elementor/page/init', function(){
            fixAmpersands(document);
        });
    
        $(document).on('et_ajax_request_success et_pb_ajax_page et_load_products et_filter_products', function(){
            fixAmpersands(document);
        });
    
        $(document).ajaxComplete(function(){
            fixAmpersands(document);
        });
    
        const observer = new MutationObserver(function(mutations){
            mutations.forEach(function(m){
                if(m.addedNodes.length > 0){
                    fixAmpersands(document);
                }
            });
        });
        observer.observe(document.body, { childList: true, subtree: true });
    
    });

    We have also added the following custom code to xstore-child/functions.php.
    add_action( ‘wp_enqueue_scripts’, ‘fix_ampersant_script’ );

    function fix_ampersant_script() {
        wp_register_script(
            'fix-ampersant',
            get_stylesheet_directory_uri() . '/js/fix-ampersant.js',
            array('jquery'),
            '1.0',
            true
        );
    
        wp_enqueue_script('fix-ampersant');
    }

    Please remember to clear your browser cache before checking the results.

    Best regards,
    8Theme Team

Want to reply? Log in, or register with your ThemeForest purchase code, to reply to this topic.

Login / Register