【问题标题】:Shopify products' collection empty in collection contextShopify 产品的集合在集合上下文中为空
【发布时间】:2019-03-11 15:08:09
【问题描述】:

我正在尝试按集合过滤我的相关产品。

每个产品都属于两个系列:一个用于材料,一个用于房间。

Material one 是一个自动收集带有特定标签的产品。

房间一是手动填充的。

当我进入产品页面时,我会像这样加载相关产品(相关产品必须与当前产品共享两个集合):

{% for related_product in collection.products %}


{% if product.collections[0].handle == 
related_product.collections[0].handle and product.collections[1].handle 
== related_product.collections[1].handle and related_product.handle != 
product.handle %}

<div class="Carousel__Cell">
  {% include 'product-item', product: related_product, 
   show_product_info: 
   section.settings.show_product_info, show_labels: true %}
</div>

{% endif %}

{% endfor %}

奇怪的是,这仅适用于某些产品。在其中一些产品中,product.collection 似乎为空,这没有任何意义!

所有产品都正确显示在正确的集合中。

问题发生在集合的上下文中(但我们需要让它在所有上下文中都有效)

【问题讨论】:

    标签: shopify shopify-template


    【解决方案1】:

    我们发现这是一个导入/同步问题。我们必须删除所有现有产品并重新导入它们。它解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多