Magento Asked by Abhishek Dhanraj Shahdeo on December 6, 2021
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?
Place the below code at the end of
appdesignfrontendthemedefaulttemplatecatalogsearchresult.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>
Answered by Harendra Prajapati on December 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP