Hide unnecessary paging links - xmpie-users/uStore-js GitHub Wiki

In uStore admin, you can choose to enable paging in a storefront. This is designed for stores with many products in each group, so that once a set number of products is shown on the page, remaining products are hidden and page numbers are added to enable the user to move to other pages of products.

Unfortunately, uStore adds page numbers even if all products fit on one page.

This JavaScript will automatically hide the paging numbers when all products fit on one page.

<script type="text/javascript">
// Hide paging links if only one page
$(window).load (function () {
  if ($("#pager1").length || $("#pager2").length) {
    if(($("#result").html().length==0) || (!$("#pager1").find(".prev").attr("href") && !$("#pager1").find(".next").attr("href")) || (!$("#pager2").find(".prev").attr("href") && !$("#pager2").find(".next").attr("href"))) {
      $("#pager1").hide();
      $("#pager2").hide();
    }
  }    
});
</script>

For information on how to add JavaScript to your store: How to add JavaScript to a storefront.

⚠️ **GitHub.com Fallback** ⚠️