我的液体代码是
{% assign _product_id = product.id %}
{% assign _product_tag = product.collections[0].title}
{% assign _product_name = product.title %}
{{_product_tag}}
{% assign pagla_array = collections[_product_tag].products %}
{{ pagla_array.first.title }}
Run Code Online (Sandbox Code Playgroud)
这里最后一行什么也没显示。如果我使用静态索引进行分配,pagla_array例如 {% allocate pagla_array =collections['Beans'].products %}那么它会显示值。我在这里犯了什么错?
这行:
{% 分配 _product_tag = 产品.collections[0].title}
未正确关闭。它应该以%}
此外,您应该使用集合的句柄,而不是标题。
所以它应该变成:
{% assign _product_tag = product.collections[0].handle %}
....
{% assign pagla_array = collections[_product_tag].products %}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4508 次 |
| 最近记录: |