第 105 期 广告投放之 同一产品系列 置顶不同商品
1 min read

第 105 期 广告投放之 同一产品系列 置顶不同商品

点击这里查看视频演示

Impulse 主题代码一键复制

Symmetry 原主题代码

{% for product in collection.products %}
    {% render 'product-block', product: product, custom_aspect_ratio: chosen_aspect_ratio, manual_image_load: manual_image_load, animate: true %}
{% endfor %}

修改后代码

{% assign handles = collection.sort_by | split: "," %}
{% if current_page == 1 %}
{% for handle in handles %}
{% assign topProduct = all_products[handle] %}
{% if topProduct != empty %}
{% render 'product-block', product: topProduct, custom_aspect_ratio: chosen_aspect_ratio, manual_image_load: manual_image_load, animate: true %}
{% endif %}
{% endfor %}
{% endif %}

{%- for product in collection.products -%}
{% if handles contains product.handle %}
{% continue %}
{% else %}
{% render 'product-block', product: product, custom_aspect_ratio: chosen_aspect_ratio, manual_image_load: manual_image_load, animate: true %}
{% endif %}
{% endfor %}

使用方法

?page=1&sort_by=product.handle 如果多个的话,用英文逗号分隔,不需要使用空格