|
39 | 39 | {%- endstyle -%} |
40 | 40 |
|
41 | 41 | {%- liquid |
42 | | - assign products_to_display = section.settings.collection.all_products_count |
| 42 | + assign featured_collection = section.settings.collection |
| 43 | + assign collection_products = featured_collection.products |
| 44 | + assign collection_products_count = featured_collection.products_count |
| 45 | + assign products_to_display = section.settings.products_to_show |
| 46 | + assign more_in_collection = false |
43 | 47 |
|
44 | | - if section.settings.collection.all_products_count > section.settings.products_to_show |
45 | | - assign products_to_display = section.settings.products_to_show |
| 48 | + if collection_products_count > products_to_display |
46 | 49 | assign more_in_collection = true |
| 50 | + else |
| 51 | + assign products_to_display = collection_products_count |
47 | 52 | endif |
48 | 53 |
|
49 | 54 | assign columns_mobile_int = section.settings.columns_mobile | plus: 0 |
|
102 | 107 | > |
103 | 108 | {% assign skip_card_product_styles = false %} |
104 | 109 |
|
105 | | - {%- if section.settings.collection.products.size > 0 -%} |
| 110 | + {%- if collection_products.size > 0 -%} |
| 111 | + {% assign skip_card_product_styles = false %} |
106 | 112 | {% assign lazy_load = false %} |
107 | | - {% paginate section.settings.collection.products by section.settings.products_to_show %} |
108 | | - {%- for product in section.settings.collection.products limit: section.settings.products_to_show -%} |
109 | | - {% if lazy_load == false and forloop.index > max_columns_to_show %} |
110 | | - {% assign lazy_load = true %} |
| 113 | + {% if products_to_display > max_columns_to_show %} |
| 114 | + {% assign lazy_load = true %} |
| 115 | + {% endif %} |
| 116 | + {%- for product in collection_products limit: products_to_display -%} |
| 117 | + <li |
| 118 | + id="Slide-{{ section.id }}-{{ forloop.index }}" |
| 119 | + class=" |
| 120 | + grid__item{% if show_mobile_slider or show_desktop_slider %} slider__slide{% endif %}{% if settings.animations_reveal_on_scroll %} scroll-trigger |
| 121 | + animate--slide-in{% endif %} |
| 122 | + " |
| 123 | + {% if settings.animations_reveal_on_scroll %} |
| 124 | + data-cascade |
| 125 | + style="--animation-order: {{ forloop.index }};" |
111 | 126 | {% endif %} |
112 | | - <li |
113 | | - id="Slide-{{ section.id }}-{{ forloop.index }}" |
114 | | - class="grid__item{% if show_mobile_slider or show_desktop_slider %} slider__slide{% endif %}{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}" |
115 | | - {% if settings.animations_reveal_on_scroll %} |
116 | | - data-cascade |
117 | | - style="--animation-order: {{ forloop.index }};" |
118 | | - {% endif %} |
119 | | - > |
120 | | - {% render 'card-product', |
121 | | - card_product: product, |
122 | | - media_aspect_ratio: section.settings.image_ratio, |
123 | | - image_shape: section.settings.image_shape, |
124 | | - lazy_load: lazy_load, |
125 | | - show_secondary_image: section.settings.show_secondary_image, |
126 | | - show_vendor: section.settings.show_vendor, |
127 | | - show_rating: section.settings.show_rating, |
128 | | - skip_styles: skip_card_product_styles, |
129 | | - section_id: section.id, |
130 | | - quick_add: section.settings.quick_add |
131 | | - %} |
132 | | - </li> |
133 | | - {%- assign skip_card_product_styles = true -%} |
134 | | - {%- endfor -%} |
135 | | - {% endpaginate %} |
| 127 | + > |
| 128 | + {% |
| 129 | + render 'card-product', |
| 130 | + card_product: product, |
| 131 | + media_aspect_ratio: section.settings.image_ratio, |
| 132 | + image_shape: section.settings.image_shape, |
| 133 | + lazy_load: lazy_load and forloop.index > max_columns_to_show, |
| 134 | + show_secondary_image: section.settings.show_secondary_image, |
| 135 | + show_vendor: section.settings.show_vendor, |
| 136 | + show_rating: section.settings.show_rating, |
| 137 | + skip_styles: skip_card_product_styles, |
| 138 | + section_id: section.id, |
| 139 | + quick_add: section.settings.quick_add |
| 140 | + %} |
| 141 | + </li> |
| 142 | + {%- assign skip_card_product_styles = true -%} |
| 143 | + {%- endfor -%} |
136 | 144 | {%- else -%} |
137 | 145 | {%- for i in (1..section.settings.columns_desktop) -%} |
138 | 146 | <li |
|
236 | 244 | "step": 1, |
237 | 245 | "default": 4, |
238 | 246 | "label": "t:sections.featured-collection.settings.products_to_show.label" |
239 | | - }, |
| 247 | + }, |
240 | 248 | { |
241 | 249 | "type": "header", |
242 | 250 | "content": "t:sections.featured-collection.settings.header_text.content" |
243 | | - }, |
| 251 | + }, |
244 | 252 | { |
245 | 253 | "type": "inline_richtext", |
246 | 254 | "id": "title", |
|
284 | 292 | "type": "checkbox", |
285 | 293 | "id": "show_description", |
286 | 294 | "label": "t:sections.featured-collection.settings.show_description.label", |
287 | | - "default": false |
| 295 | + "default": false |
288 | 296 | }, |
289 | 297 | { |
290 | 298 | "type": "select", |
|
309 | 317 | { |
310 | 318 | "type": "header", |
311 | 319 | "content": "t:sections.featured-collection.settings.header_collection.content" |
312 | | - }, |
| 320 | + }, |
313 | 321 | { |
314 | 322 | "type": "range", |
315 | 323 | "id": "columns_desktop", |
|
319 | 327 | "default": 4, |
320 | 328 | "label": "t:sections.featured-collection.settings.columns_desktop.label" |
321 | 329 | }, |
322 | | - { |
| 330 | + { |
323 | 331 | "type": "checkbox", |
324 | 332 | "id": "enable_desktop_slider", |
325 | 333 | "label": "t:sections.featured-collection.settings.enable_desktop_slider.label", |
|
357 | 365 | } |
358 | 366 | ], |
359 | 367 | "default": "solid" |
360 | | - }, |
| 368 | + }, |
361 | 369 | { |
362 | 370 | "type": "color_scheme", |
363 | 371 | "id": "color_scheme", |
|
487 | 495 | "label": "t:sections.featured-collection.settings.columns_mobile.options__2.label" |
488 | 496 | } |
489 | 497 | ] |
490 | | - }, |
| 498 | + }, |
491 | 499 | { |
492 | 500 | "type": "checkbox", |
493 | 501 | "id": "swipe_on_mobile", |
494 | 502 | "default": false, |
495 | 503 | "label": "t:sections.featured-collection.settings.swipe_on_mobile.label" |
496 | | - }, |
| 504 | + }, |
497 | 505 | { |
498 | 506 | "type": "header", |
499 | 507 | "content": "t:sections.all.padding.section_padding_heading" |
|
0 commit comments