Guest User

Untitled

a guest
Jan 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. <!-- /sections/list-collections.liquid -->
  2. {% case section.settings.grid %}
  3. {% when 1 %}
  4. {% assign grid_width_large = 'large--one-third push--large--one-third clear' %}
  5. {% assign grid_width_medium = 'medium--one-half push--medium--one-quarter clear' %}
  6. {% assign grid_width_small = 'small--one-whole' %}
  7. {% when 2 %}
  8. {% assign grid_width_large = 'large--one-half' %}
  9. {% assign grid_width_medium = 'medium--one-half' %}
  10. {% assign grid_width_small = 'small--one-half' %}
  11. {% when 3 %}
  12. {% assign grid_width_large = 'large--one-third' %}
  13. {% assign grid_width_medium = 'medium--one-third' %}
  14. {% assign grid_width_small = 'small--one-whole' %}
  15. {% when 4 %}
  16. {% assign grid_width_large = 'large--one-quarter' %}
  17. {% assign grid_width_medium = 'medium--one-half' %}
  18. {% assign grid_width_small = 'small--one-half' %}
  19. {% when 5 %}
  20. {% assign grid_width_large = 'large--one-fifth' %}
  21. {% assign grid_width_medium = 'medium--one-third' %}
  22. {% assign grid_width_small = 'small--one-half' %}
  23. {% when 6 %}
  24. {% assign grid_width_large = 'large--one-sixth' %}
  25. {% assign grid_width_medium = 'medium--one-third' %}
  26. {% assign grid_width_small = 'small--one-half' %}
  27. {% else %}
  28. {% assign grid_width_large = 'large--one-quarter' %}
  29. {% assign grid_width_medium = 'medium--one-half' %}
  30. {% assign grid_width_small = 'small--one-half' %}
  31. {% endcase %}
  32.  
  33. {%- assign product_limit = section.settings.grid | times: section.settings.rows -%}
  34.  
  35. <div class="wrapper page-margin">
  36. {% if section.settings.display_type == 'all' %}
  37. {% for collection in collections %}
  38. {% unless collection.handle == 'frontpage' %}
  39. {% capture collection_title %}{{ collection.title | escape }}{% endcapture %}
  40. <div class="collection-list-item">
  41. <div class="section-header">
  42. <h3 class="h3 section-header__left title"><a href="{{ collection.url }}" title="{{ 'collections.general.link_title' | t: title: collection_title }}">{{ collection_title }} &rsaquo;</a></h3>
  43. </div>
  44. <div class="grid-uniform{% if settings.image_autoheight_enable %} image_autoheight_enable{% endif %}">
  45. {% for product in collection.products limit:product_limit %}
  46. {% include 'product-grid-item' %}
  47. {% endfor %}
  48. </div>
  49. </div>
  50. {% endunless %}
  51. {% endfor %}
  52. {% else %}
  53. {% for block in section.blocks %}
  54. {%- assign collection = collections[block.settings.collection] -%}
  55. {% capture collection_title %}{{ collection.title | escape }}{% endcapture %}
  56. <div class="collection-list-item">
  57. <div class="section-header">
  58. <h3 class="h3 section-header__left title"><a href="{{ collection.url }}" title="{{ 'collections.general.link_title' | t: title: collection_title }}">{{ collection_title }} &rsaquo;</a></h3>
  59. </div>
  60. <div class="grid-uniform{% if settings.image_autoheight_enable %} image_autoheight_enable{% endif %}">
  61. {% for product in collection.products limit:product_limit %}
  62. {% include 'product-grid-item' %}
  63. {% endfor %}
  64. </div>
  65. </div>
  66. {% endfor %}
  67. {% endif %}
  68. </div>
  69.  
  70.  
  71. {% schema %}
  72. {
  73. "name": "Collection list",
  74. "settings": [
  75. {
  76. "type": "paragraph",
  77. "content": "All of your collections are listed by default. To customize your list, choose 'Selected' and add collections."
  78. },
  79. {
  80. "type": "radio",
  81. "id": "display_type",
  82. "label": "Select collections to show",
  83. "default": "all",
  84. "options": [
  85. {
  86. "value": "all",
  87. "label": "All"
  88. },
  89. {
  90. "value": "selected",
  91. "label": "Selected"
  92. }
  93. ]
  94. },
  95. {
  96. "type": "header",
  97. "content": "Product grid"
  98. },
  99. {
  100. "type": "range",
  101. "id": "grid",
  102. "min": 1,
  103. "max": 6,
  104. "step": 1,
  105. "label": "Products per row",
  106. "default": 4
  107. },
  108. {
  109. "type": "range",
  110. "id": "rows",
  111. "min": 1,
  112. "max": 8,
  113. "step": 1,
  114. "label": "Number of rows",
  115. "default": 1
  116. }
  117. ],
  118. "blocks": [
  119. {
  120. "type": "collection",
  121. "name": "Collection",
  122. "settings": [
  123. {
  124. "label": "Collection",
  125. "id": "collection",
  126. "type": "collection"
  127. }
  128. ]
  129. }
  130. ]
  131. }
  132. {% endschema %}
Add Comment
Please, Sign In to add comment