System limit on products in a list???

Solved
Highlighted
New Member
2 0 0

I have a page that displays a collection of products in list format. We sell to retailers, so they need a form-like display like this for quick ordering in bulk. It's working great, but the list cuts off after 98 products. Is this a limit inherent in the system? How can I bypass it and show all my products on one page? Note there are about 300 in total.

If it's impossible to show that many on one page, then can someone point me at code for paginating?

Here's what the page looks like:

Screen Shot 2020-11-11 at 11.36.35 AM.png

Here's my code, added to page.dropship-form.liquid:

 

{% assign collection = collections.dropship-products %}

{% paginate collection.products by 100 %}

<form action="/cart" method="post">
  
  {% if collection.products_count > 0 %}
    <div>
      <h1>{% if template contains 'page' %}{{ page.title }}{% else %}{{ collection.title }}{% endif %}</h1>
      <input type="submit" value="ADD TO CART" style="background-color: rgb(168, 38, 49);
  color: white; float:right"/>
    </div>
  {% else %}
    <h1>{% if template contains 'page' %}{{ page.title }}{% else %}{{ collection.title }}{% endif %}</h1>
  {% endif %}

  {% if template contains 'page' and page.content.size > 0 %}
    <div class="rte">
      {{ page.content }}
    </div>  
  {% elsif collection.description.size > 0 %}
    <div class="rte">
      {{ collection.description }}
    </div>
  {% endif %}

  {% if collection.products_count > 0 %}

    <table>
      <tbody>
      {% for product in collection.products %}
        {% if product.available %}
          {% for variant in product.variants %}
            {% if variant.available %}
              <tr class="{% cycle 'pure-table-odd', '' %}">
                <td>
                  <a href="{{ variant.url | collection }}">
                    <img src="{{ variant.image | default: product.featured_image | img_url: 'small' }}" alt="{{ variant.title | escape }}" />
                  </a>
                </td>
                <td>
                  <a href="{{ variant.url | collection }}">
                   {{ product.title }}{% unless variant.title contains 'Default' %} - {{ variant.title }}{% endunless %}{% unless variant.sku == blank %} - {{ variant.sku }}{% endunless %}
                  </a>
                </td>
                <td>
                   {{ variant.price | money }}
                </td>
                <td style="text-align:right;">
                  <input maxlength="4" size="4" name="updates[{{ variant.id }}]" onfocus="this.select()" class="quantity field" min="0" {% unless variant.inventory_management == blank or variant.inventory_policy == 'continue' %} max="{{ variant.inventory_quantity }}" {% endunless %} type="text" value="0" tabindex="1" />
                </td>
              </tr>
            {% endif %}
          {% endfor %}
        {% endif %}
      {% endfor %}
      </tbody>
    </table>
    
    <div>
      <input type="submit" value="ADD TO CART" style="background-color: rgb(168, 38, 49);
  color: white; float:right"/>
    </div>
  
  {% else %}
    <p>There are no products in this view.</p>
  {% endif %}

</form>

{% endpaginate %}

{% if collection.products_count > 0 %}
<script>
jQuery(function($) {
  $('table .quantity:first').focus();
  $('[max]').change(function() {
    var max = parseInt($(this).attr('max'), 10);
    var value = parseInt($(this).val(), 10) || 0;
    if (value > max) { 
      alert('We only have ' + max + ' of this item in stock');
      $(this).val(max); 
    }    
  });
});
</script>
{% endif %}

 

 

0 Likes
Highlighted
Shopify Expert
10007 116 1818

This is an accepted solution.

Can you drop a link to the page?

And out of sheer interest, why a page for this and not a collection? 

Your pagination code has a by value of 100. So assuming that you have 2 unavailable products this kind of feels like it's working as intended. Seeing it live could help make it clearer.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
New Member
2 0 0

Yep, that was it! Thank you Jason. It's amazing the things you don't see when you're looking too hard.

0 Likes