0

I'm using Magento 1.9 C.E, and I want to remove pagination from catalog search result page. I want all the results to be coming on the same page itself with ajax. On click of a load more or something, the next page result will load that is will get appended to this result page. Can anyone give any idea on how to achieve this one?

1 Answer 1

1

Place the below code at the end of

app\design\frontend\theme\default\temp‌​late\catalogsearch\r‌​esult.phtml

<script>
    jQuery(function () {
        jQuery(body).bind('scroll', function () {
            if (jQuery(this).scrollTop() + jQuery(this).innerHeight() + 200 >= jQuery(this)[0].scrollHeight) {
                if (jQuery.active <= 0) {
                    jQuery(".ajax-loader").show();
                    var nextPageUrl = jQuery('.pages .i-next').attr('href');
                    if (nextPageUrl == undefined) {
                        jQuery(".ajax-loader").hide();
                    } else {
                        jQuery.ajax({
                            url: nextPageUrl,
                            success: function (msg)
                            {
                                jQuery(".ajax-loader").hide();
                                    //refresh the page class element
                                jQuery('.pages').html(jQuery(msg).find('.pages').html());
                                    //append the list to the existing product list
                                jQuery('.category-products').append(jQuery(msg).find('.category-products').html());
                                    //check if there are more products to be loaded or not
                                return false;
                            }
                        });
                    }
                }
            }
        });
    });

</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.