【问题标题】:how i can show random products on home page in shopify我如何在shopify的主页上显示随机产品
【发布时间】:2014-12-16 05:33:45
【问题描述】:

产品应在页面刷新时更改

请检查以下代码

<div id="showcase">
{% if collections.frontpage-1.products.size > 0 %}
{% capture index %}{{ 'now' | date: '%S' | times: collections.frontpage-1.products.size | divided_by: 60 }}{% endcapture %}
{% for product in collections.frontpage-1.products offset:index limit:1 %}
{% include 'product-list-repeatable-item' with product %}
{% endfor %}
{% else %}
<p>
<a href="/admin/custom_collections">
Add a product to the "frontpage" collection to see it here...
</a>
</p>
{% endif %}
</div>   

【问题讨论】:

    标签: shopify


    【解决方案1】:

    来自Shopify Documentation

    Shopify 的网页是缓存服务的。除非购物者添加产品 到他的购物车,他可能会在几个小时内获得相同的缓存页面 时间,因此您的“随机”产品在页面刷新后可能是相同的 因为它是从 Shopify 的“缓存”服务器提供的。

    一种解决方案是使用 Javascript 显示一个或多个随机产品,请参阅此链接以获取一些代码:Shopify random products with Javascript

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多