From 9e6c2fa560ba3c049b664d4f24b0ee3f6b77e642 Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Wed, 3 Jul 2024 17:13:39 +0300 Subject: [PATCH 01/11] added Mobile Breakpoint For Recommendation and fixed Recommendation Bug --- sections/findify-grid-search.liquid | 38 ++++++++++++++++++-------- sections/findify-recommendation.liquid | 4 ++- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/sections/findify-grid-search.liquid b/sections/findify-grid-search.liquid index b4c5f9d..80ad6b3 100644 --- a/sections/findify-grid-search.liquid +++ b/sections/findify-grid-search.liquid @@ -3,8 +3,10 @@ {% comment %} Recommendation fallback configuration {% endcomment %} {%- assign recommendation_id = query_parameters | split: 'recommendation_id:' | last | split: '|' | first -%} -{%- assign desktop_slide_per_view = query_parameters | split: 'desktop_slide_per_view:' | last | split: '|' | first | split: '&' | first -%} -{%- assign recommendation_title = query_parameters | split: 'recommendation_title:' | last | split: '&' | first -%}{% include 'findify-grid-connector' %} +{%- assign desktop_slide_per_view = query_parameters | split: 'desktop_slide_per_view=' | last | split: '|' | first | split: '&' | first -%} +{%- assign mobile_slide_per_view = query_parameters | split: 'mobile_slide_per_view=' | last | split: '|' | first | split: '&' | first -%} + +{%- assign recommendation_title = query_parameters | split: 'recommendation_title=' | last | split: '&' | first -%}{% include 'findify-grid-connector' %} {% comment %} Content integration configuration {% endcomment %} {%- assign use_content_integration = query_parameters | split: 'use_content_integration:' | last | split: '&' | first -%} @@ -137,18 +139,30 @@ setFindifyIsLoading(false); } else { - const initRecommendation = async (type) => await findify.recommendation.init({ - recommendation_id: "{{ recommendation_id }}", - desktop_slide_per_view, - recommendation_title - }) - - findify.core.init.promise.then(() => { - initRecommendation() - window.addEventListener("popstate", () => { + const id = "{{ recommendation_id }}"; + + const initRecommendation = async () => { + if (!id) { + console.warn( + 'To display a Findify recommendation you should insert the ID within the Findify Recommendation App Block' + ); + return; + } + await findify.recommendation.init({ + id, + desktop_slide_per_view: "{{ desktop_slide_per_view }}", + title: "{{ recommendation_title }}", + mobile_slide_per_view: "{{ mobile_slide_per_view }}", + }); + }; + + findify.core.init.then(() => { + initRecommendation(); + + window.addEventListener('popstate', () => { initRecommendation(); }); - }); + }); } diff --git a/sections/findify-recommendation.liquid b/sections/findify-recommendation.liquid index a501a58..29df894 100644 --- a/sections/findify-recommendation.liquid +++ b/sections/findify-recommendation.liquid @@ -3,6 +3,8 @@ {%- assign recommendation_id = query_parameters | split: 'recommendation_id=' | last | split: '&' | first | url_decode -%} {%- assign desktop_slide_per_view = query_parameters | split: 'desktop_slide_per_view=' | last | split: '&' | first -%} +{%- assign mobile_slide_per_view = query_parameters | split: 'mobile_slide_per_view=' | last | split: '|' | first | split: '&' | first -%} + {%- assign title = query_parameters | split: 'title=' | last | split: '&' | first | url_decode -%}
@@ -31,7 +33,7 @@ slidesPerView: "{{ desktop_slide_per_view }}", breakpoints: { 320: { - slidesPerView: 2, + slidesPerView: "{{ mobile_slide_per_view }}", spaceBetween: 20, }, 480: { From 3ea561fc7bf1dfca106f5e84a3140ae621615ccf Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Thu, 4 Jul 2024 11:08:40 +0300 Subject: [PATCH 02/11] updated assignment of props --- sections/findify-grid-search.liquid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sections/findify-grid-search.liquid b/sections/findify-grid-search.liquid index 80ad6b3..296cefc 100644 --- a/sections/findify-grid-search.liquid +++ b/sections/findify-grid-search.liquid @@ -3,8 +3,8 @@ {% comment %} Recommendation fallback configuration {% endcomment %} {%- assign recommendation_id = query_parameters | split: 'recommendation_id:' | last | split: '|' | first -%} -{%- assign desktop_slide_per_view = query_parameters | split: 'desktop_slide_per_view=' | last | split: '|' | first | split: '&' | first -%} -{%- assign mobile_slide_per_view = query_parameters | split: 'mobile_slide_per_view=' | last | split: '|' | first | split: '&' | first -%} +{%- assign desktop_slide_per_view = query_parameters | split: 'desktop_slide_per_view:' | last | split: '|' | first | split: '&' | first -%} +{%- assign mobile_slide_per_view = query_parameters | split: 'mobile_slide_per_view:' | last | split: '|' | first | split: '&' | first -%} {%- assign recommendation_title = query_parameters | split: 'recommendation_title=' | last | split: '&' | first -%}{% include 'findify-grid-connector' %} From 4087c40f78ec097d1edaa40585f1fc97fc4c1640 Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Thu, 4 Jul 2024 11:41:43 +0300 Subject: [PATCH 03/11] Added Desktop and Mobile Products per view Settings --- sections/findify-grid-collection.liquid | 18 +++++++++++++++++- sections/findify-grid-search.liquid | 24 +++++++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/sections/findify-grid-collection.liquid b/sections/findify-grid-collection.liquid index 818168b..0765b7a 100644 --- a/sections/findify-grid-collection.liquid +++ b/sections/findify-grid-collection.liquid @@ -1,5 +1,10 @@ {%- assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: '\/', '/' | replace: '%20', ' ' | replace: '\u0026', '&' | replace: '%7C', '|' | replace: '%27', "'" -%} {%- assign query_parameters = page_url | split: 'sections=findify-grid-collection&' | last -%} +{% comment %} Grid config {% endcomment %} + +{%- assign desktop_products_per_view = query_parameters | split: 'desktop_products_per_view:' | last | split: '|' | first | split: '&' | first -%} +{%- assign mobile_products_per_view = query_parameters | split: 'mobile_products_per_view:' | last | split: '|' | first | split: '&' | first -%} + {% include 'findify-grid-connector' %} {% assign findify_filters_component_id = 'findify-filters-sidebar' %} @@ -87,7 +92,18 @@
{% endif %} - +