我想在我的shopify商店中通过标签显示相关产品。这段代码非常完美。但它会在产品下显示280x390像素的图像。这意味着它们非常庞大。我怎样才能使它们连续变小。 (通常是1行中有6种产品)注意:我的主图像是1200x1800像素。
{% assign number_of_related_products_to_show = 6 %}
{% assign current_product = product %} {% assign current_product_tags = product.tags %}
{% assign found_first_match = false %} {% assign found_second_match = false %}
{% assign first_related_product = true %}
{% paginate collections.all.products by 1000 %}
{% for product in collections.all.products %}
{% unless product.handle == current_product.handle %}
{% for tag in product.tags %}
{% if current_product_tags contains tag %}
{% if found_first_match == false %}
{% assign found_first_match = true %}
{% assign first_match = tag %}
{% else %}
{% assign found_second_match = true %}
{% assign second_match = tag %}
{% endif %}
{% endif %}
{% endfor %}
{% if found_first_match == true %}
{% if first_related_product == true %}
{% assign first_related_product = false %}
{% endif %}
{% if product.tags contains first_match or product.tags contains second_match %}
{% include 'product-grid-item' with collection.handle %}
{% endif %}
{% endif %}
{% endunless %}
{% endfor %}
{% if first_related_product == false %}
{% endif %}
{% endpaginate %}