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?
Add a comment
|
1 Answer
Place the below code at the end of
app\design\frontend\theme\default\template\catalogsearch\result.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>