Php shopify上未显示相关产品

Php shopify上未显示相关产品,php,shopify,liquid,Php,Shopify,Liquid,我的相关产品上有以下代码: <h3>HAVE YOU TRIED...</h3> {% assign max = 10 %} {% assign count = '' %} {% assign list = '' %} {% capture list %},{{ product.id }}{% endcapture %} {% for collection in product.collections %} {% if collection.handle c

我的相关产品上有以下代码:

<h3>HAVE YOU TRIED...</h3>  
{% assign max = 10 %}
{% assign count = '' %}
{% assign list = '' %}
{% capture list %},{{ product.id }}{% endcapture %}

{% for collection in product.collections %}
    {% if collection.handle contains 'related' %}
        {% for product_related in collection.products %}
            {% capture id %},{{ product_related.id }}{% endcapture %}
            {% unless list contains id %}
                {% if count.size < max and product_related.images.size > 0 %} 
                    <div class="rel-product">
                        <div class="rel-img">
                          {% for image in product_related.images offset:1 limit:1 %}
                                <a href="{{ product_related.url | escape }}"><img src="{{ image.src | product_img_url: 'compact' }}}" alt="" /></a>
                            {% endfor %}
                        </div>

                        <div class="rel-cnt">
                            <h6><a href="{{ product_related.url | escape }}">{{ product_related.title }}</a></h6>
                            <p>{{ variant.option1 }}</p>
                            <span class="price">{{ product_related.price | money }}</span>
                        </div>
                    </div>
                    {% capture count %}{{ count }}.{% endcapture %}
                    {% capture list %}{{ list }}{{ id }}{% endcapture %}
                {% endif %}
            {% endunless %}
        {% endfor %}
    {% endif %}
{% endfor %}
你试过。。。
{%assign max=10%}
{%assign count=''%}
{%assign list=''%}
{%capture list%},{{product.id}{%endcapture%}
{%用于product.collections%中的集合}
{%如果collection.handle包含“相关”%}
{collection.products%}中与产品_相关的%
{%capture-id%},{{product_-related.id}}{%endcapture%}
{%除非列表包含id%}
{%if count.size0%}
{与产品_相关的图像的百分比。图像偏移量:1限制:1%}
{%endfor%}
{{variant.option1}}

{{与产品相关的价格}货币} {%capture count%}{{count}.{%endcapture%} {%capture list%}{{list}{{id}{%endcapture%} {%endif%} {%end除非%} {%endfor%} {%endif%} {%endfor%}

对于一个系列中的产品,它似乎可以正常工作,但对于另一个系列中的产品,它根本不起作用,“have you Twest”框是空的。有人能告诉我这段代码在shopify中挑选相关产品方面做了什么,以及为什么它可能没有为该集合中的项目显示任何相关产品。

首先打印您的“产品”数组,并检查它将返回给您什么,同时检查其他产品