简体   繁体   English

Shopify Search。液体分页失败

[英]Shopify search.liquid pagination broken

I'm trying to display the full 50 products that Shopify allows per page call, but in my search results only 10 items are displayed and the pagination links lead to the same 10 products for each page. 我正在尝试显示Shopify每个页面调用允许的全部50种产品,但是在我的搜索结果中仅显示10个项目,分页链接也导致每个页面具有相同的10个产品。

I've read through the documentation and even used the template from Caroline Schnapp's skeleton theme here: https://github.com/Shopify/skeleton-theme/blob/master/templates/search.liquid , I get the same results no matter what I try. 我已经阅读了文档,甚至在这里使用了Caroline Schnapp的骨架主题的模板: https : //github.com/Shopify/skeleton-theme/blob/master/templates/search.liquid ,无论如何我都会得到相同的结果我尝试的

To summarise, I'd like to display 50 products and pagination links on my search results page. 总而言之,我想在搜索结果页面上显示50个产品和分页链接。

Can anyone shed any light on this please? 任何人都可以阐明这一点吗?

Here's the contents of my search.liquid template: 这是我的search.liquid模板的内容:

{% paginate search.results by 50 %}

{% if search.results_count == 0 %}

  <div class="search-noresults">
      <h2 class="no-results">Nothing found for <span class="search-terms">{{ search.terms }}</span></h2>
      <p class="search-again">try searching again</p>
  </div>

{% else %}
  <section class="search-grid clearfix">
    <h2 class="results-for">Results for <span class="search-terms">{{ search.terms }}</span></h2>

    {% for product in search.results %}
      <section class="collection-grid ">
                <div class="product-box" href="{{product.url}}">
                    <a href="{{product.url}}" class="ajaxify-link"><img src="{{ product.featured_image | product_img_url: 'large'}}" alt="{{ product.description | strip_html | truncate: 75 }} click for more information" /></a>
                <hr class="collection-hr"><span class="grid-title">{{product.title}}</span><br/><span class="grid-price">{{ product.price | divided_by: 100 | replace: '.',' ' | truncatewords: 1 | remove: '...' }} £</span>
                </div>
      </section>
    {% endfor %}
  </section>

  {% if search.results_count > 50 %}
    <div id="pagination">
        {{ paginate | default_pagination }}
    </div>

{% endif %}

{% endif %}


{% endpaginate %}

So it turns out that all I needed to do was to activate the shop and the pagination worked as normal, when the shop is in dev mode pagination doesn't work as expected. 因此,事实证明,我所要做的就是激活商店,并且分页正常工作,而商店处于开发人员模式时分页无法正常工作。 Hopefully this helps someone else out there as I didn't find any of that in the documentation. 希望这对其他人有所帮助,因为我在文档中没有找到任何其他内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM