Guest User

Untitled

a guest
Mar 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. {% assign lowercase_tags = customer.tags | downcase %}
  2. {% assign wholesale_customer = false %}
  3.  
  4. {% if lowercase_tags contains 'wholesale' %}
  5. {% assign wholesale_customer = true %}
  6. {% endif %}
  7.  
  8. {% layout none %}
  9. {% capture results %}
  10. {% for item in search.results %}
  11.  
  12. {% assign wholesale_product = false %}
  13. {% assign show_item = nil %}
  14.  
  15. {% for product_collection in item.collections %}
  16. {% if product_collection.title == 'Wholesale' %}
  17. {% assign wholesale_product = true %}
  18. {% endif %}
  19. {% endfor %}
  20.  
  21. {% if wholesale_customer == true and wholesale_product == true %}
  22. {% assign show_item = true %}
  23. {% elsif wholesale_customer == false and wholesale_product == false %}
  24. {% assign show_item = true %}
  25. {% endif %}
  26.  
  27. {% if show_item == true %}
  28. {
  29. "title": {{ item.title | json }},
  30. "url": {{ item.url | within: item.collections.last | json }},
  31. "thumbnail": {{ item.featured_image.src | product_img_url: 'thumb' | json }},
  32. "wholesale_customer": {{ wholesale_customer | json }},
  33. "wholesale_product": {{ wholesale_product | json }}
  34. }
  35. {% endif %}
  36.  
  37. {% unless forloop.last %},{% endunless %}
  38. {% endfor %}
  39. {% endcapture %}
  40. {
  41. "results_count": {{ search.results_count }},
  42. "results": [{{ results }}]
  43. }
  44.  
  45. {% if wholesale_customer == true and wholesale_product == true %}
  46. {% assign show_item = true %}
  47. {% assign debug = "wholesale_customer" %}
  48. {% elsif wholesale_customer == false and wholesale_product == false %}
  49. {% assign debug = "retail_customer" %}
  50. % assign show_item = true %}
  51. {% endif %}
  52.  
  53. {% if show_item == true %}
  54. {
  55. "title": {{ item.title | json }},
  56. "url": {{ item.url | within: item.collections.last | json }},
  57. "thumbnail": {{ item.featured_image.src | product_img_url: 'thumb' | json }},
  58. "wholesale_customer": {{ wholesale_customer | json }},
  59. "wholesale_product": {{ wholesale_product | json }},
  60. "debug": {{ debug | json }}
  61. }
  62. {% endif %}
Add Comment
Please, Sign In to add comment