Advertisement
Guest User

Intrepid Cosmonaut Venture

a guest
Sep 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. {% assign number_of_products = 4 %}
  2. {% assign number_of_products_to_fetch = number_of_products | plus: 1 %}
  3.  
  4. {% if collection == null or collection.handle == 'frontpage' or collection.handle == 'all' %}
  5. {% assign found_a_collection = false %}
  6. {% for c in product.collections %}
  7. {% if found_a_collection == false and c.handle != 'frontpage' and c.handle != 'all' and c.all_products_count > 1 %}
  8. {% assign found_a_collection = true %}
  9. {% assign collection = c %}
  10. {% endif %}
  11. {% endfor %}
  12. {% endif %}
  13.  
  14. {% if collection and collection.products_count > 1 %}
  15. <hr class="hr--clear hr--small">
  16. <div class="section-header section-header--large">
  17. <h3 class="content-block__title">You Might Also Be Interested In:</h3>
  18. </div>
  19. <div class="grid">
  20. {% assign current_product = product %}
  21. {% assign current_product_found = false %}
  22. {% for product in collection.products limit: number_of_products_to_fetch %}
  23. {% if product.handle == current_product.handle %}
  24. {% assign current_product_found = true %}
  25. {% else %}
  26. {% unless current_product_found == false and forloop.last %}
  27. {% assign grid_item_width = 'large--one-quarter medium--one-quarter small--one-half' %}
  28. <div class="grid__item medium-up--one-quarter small--one-half">
  29. {% include 'product-card' %}
  30. </div>
  31. {% endunless %}
  32. {% endif %}
  33. {% endfor %}
  34. </div>
  35. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement