我正在尝试根据每个客户标签的供应商类型排除产品。例如,如果客户登录并标记为“设计者”,则他们只能从搜索结果中的供应商类型“设计者”中获取产品。
我将代码放在{%如果search.performed%}的下面,但没有成功。预先感谢。
{% assign isWholesaler = false %}
{% if customer %}
{% if customer.tags contains 'wholesale' %}
{% assign isWholesaler = true %}
{% endif %}
{% endif %}
{% if isWholesaler %}
{% for result in search.results %}
{% if item.product.vendor == 'CompanyName Wholesale' %}
{% include 'search-result' %}
{% else %}
{% endif %}
{% endfor %}
{% endif %}
{% assign isDesigner = false %}
{% if customer %}
{% if customer.tags contains 'designer' %}
{% assign isDesigner = true %}
{% endif %}
{% endif %}
{% if isDesigner %}
{% for item in search.results %}
{% if item.product.vendor == 'CompanyName Designer' %}
{% include 'search-result' %}
{% else %}
{% endif %}
{% endfor %}
{% endif %}
{% assign isConsumer = false %}
{% if customer %}
{% if customer.tags contains 'consumer' %}
{% assign isConsumer = true %}
{% endif %}
{% endif %}
{% if isConsumer %}
{% for item in search.results %}
{% if item.product.vendor == 'CompanyName' %}
{% include 'search-result' %}
{% else %}
{% endif %}
{% endfor %}
{% endif %}