From 14a18a0947a6bae63254cce60fb1023e38c9675a Mon Sep 17 00:00:00 2001 From: Ludo Date: Mon, 16 Dec 2024 16:16:11 -0400 Subject: [PATCH 1/2] Feat. Collection - add pagination to limit the amount of fetched data --- sections/featured-collection.liquid | 51 ++++++++++++++++------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/sections/featured-collection.liquid b/sections/featured-collection.liquid index b5261870c0a..a73f979d274 100644 --- a/sections/featured-collection.liquid +++ b/sections/featured-collection.liquid @@ -95,28 +95,33 @@ aria-label="{{ 'general.slider.name' | t }}" > {% assign skip_card_product_styles = false %} - {%- for product in section.settings.collection.products limit: section.settings.products_to_show -%} -
  • - {% render 'card-product', - card_product: product, - media_aspect_ratio: section.settings.image_ratio, - image_shape: section.settings.image_shape, - show_secondary_image: section.settings.show_secondary_image, - show_vendor: section.settings.show_vendor, - show_rating: section.settings.show_rating, - skip_styles: skip_card_product_styles, - section_id: section.id, - quick_add: section.settings.quick_add - %} -
  • - {%- assign skip_card_product_styles = true -%} + + {%- if section.settings.collection.products.size > 0 -%} + {% paginate section.settings.collection.products by section.settings.products_to_show %} + {%- for product in section.settings.collection.products limit: section.settings.products_to_show -%} +
  • + {% render 'card-product', + card_product: product, + media_aspect_ratio: section.settings.image_ratio, + image_shape: section.settings.image_shape, + show_secondary_image: section.settings.show_secondary_image, + show_vendor: section.settings.show_vendor, + show_rating: section.settings.show_rating, + skip_styles: skip_card_product_styles, + section_id: section.id, + quick_add: section.settings.quick_add + %} +
  • + {%- assign skip_card_product_styles = true -%} + {%- endfor -%} + {% endpaginate %} {%- else -%} {%- for i in (1..section.settings.columns_desktop) -%}
  • {%- endfor -%} - {%- endfor -%} + {%- endif -%} {%- if show_mobile_slider or show_desktop_slider -%}
    From bcf80df8c2c3f05f4ff11f99a4202bc5f64fd60e Mon Sep 17 00:00:00 2001 From: Ludo Date: Mon, 13 Jan 2025 10:11:21 -0400 Subject: [PATCH 2/2] address review comment and remove unnecessary limi t --- sections/featured-collection.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/featured-collection.liquid b/sections/featured-collection.liquid index a73f979d274..bc07d221ed4 100644 --- a/sections/featured-collection.liquid +++ b/sections/featured-collection.liquid @@ -98,7 +98,7 @@ {%- if section.settings.collection.products.size > 0 -%} {% paginate section.settings.collection.products by section.settings.products_to_show %} - {%- for product in section.settings.collection.products limit: section.settings.products_to_show -%} + {%- for product in section.settings.collection.products -%}