Skip to content

Commit

Permalink
Feat. Collection - add pagination to limit the amount of fetched data (
Browse files Browse the repository at this point in the history
…#3688)

* Feat. Collection - add pagination to limit the amount of fetched data

* address review comment and remove unnecessary limi
t
  • Loading branch information
ludoboludo authored Jan 13, 2025
1 parent d2612f0 commit 4cd128f
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions sections/featured-collection.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
<li
id="Slide-{{ section.id }}-{{ forloop.index }}"
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 %}"
{% if settings.animations_reveal_on_scroll %}
data-cascade
style="--animation-order: {{ forloop.index }};"
{% endif %}
>
{% 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
%}
</li>
{%- 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 -%}
<li
id="Slide-{{ section.id }}-{{ forloop.index }}"
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 %}"
{% if settings.animations_reveal_on_scroll %}
data-cascade
style="--animation-order: {{ forloop.index }};"
{% endif %}
>
{% 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
%}
</li>
{%- assign skip_card_product_styles = true -%}
{%- endfor -%}
{% endpaginate %}
{%- else -%}
{%- for i in (1..section.settings.columns_desktop) -%}
<li
Expand Down Expand Up @@ -144,7 +149,7 @@
%}
</li>
{%- endfor -%}
{%- endfor -%}
{%- endif -%}
</ul>
{%- if show_mobile_slider or show_desktop_slider -%}
<div class="slider-buttons">
Expand Down

0 comments on commit 4cd128f

Please sign in to comment.