【问题标题】:Shopify - Load 'collections/all' page on my front pageShopify - 在我的首页加载“收藏/全部”页面
【发布时间】:2015-03-21 07:26:00
【问题描述】:

如何加载http://example.myshopify.com/collections/all内容 到我的shopify首页http://example.myshopify.com/

我想出了一种在 index.liquid 上硬编码 <script>window.location.href='collections/all'</script> 的方法,但我很确定那不是一种干净的方法。

我尝试将整个 collection.liquid 的代码复制到 index.liquid,但它提示我 Liquid error: Array 'collection.all.products' is not paginateable. 错误并且没有产品显示 index.liquid 页面。

知道如何在shopify的首页加载collections/all吗?

我正在使用Timber Framework,因为人们建议开始构建主题

里面

【问题讨论】:

  • 你想用 javascript 加载它们还是想用流动逻辑加载它们?
  • @drip 液体逻辑,我猜?任何事情都可以,因为这让 mi 困扰了很长时间,如果您分享任何方法,将不胜感激。我测试了液体的包含方法,对我也没有好处。 : ( ,非常感谢!

标签: javascript shopify


【解决方案1】:

在 Timber 框架中,您可以在 index.liquid 中更改此行:

{% for product in collections.frontpage.products limit:4 %}

到:

{% for product in collections.all.products %}

根据您拥有的产品数量,您可能仍希望limit 显示多少,或paginate 输出。

例如

{% paginate collections.all.products by 12 %}
{% for product in collections.all.products %}
...
{% endfor %}
{{ paginate | default_pagination }}
{% endpaginate %}

【讨论】:

    【解决方案2】:

    你包括这个:

    {% for product in collections.all.products %}
        // here you have access to each product
    {% endfor %}
    

    这将循环您的所有产品。

    您可以查看http://cheat.markdunkley.com/ 在该循环中您可以访问哪些产品变量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-04-14
      • 1970-01-01
      • 2018-11-08
      • 1970-01-01
      • 2012-09-22
      • 2022-08-04
      • 2012-05-17
      相关资源
      最近更新 更多