From b3f872ddfc79f8e9a6420bbd6e778560ad887901 Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Mon, 2 Sep 2024 14:08:59 +0300 Subject: [PATCH 1/4] fixed price bug --- snippets/findify-product-price.liquid | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/snippets/findify-product-price.liquid b/snippets/findify-product-price.liquid index 4d6c46e..c9c8954 100644 --- a/snippets/findify-product-price.liquid +++ b/snippets/findify-product-price.liquid @@ -7,17 +7,22 @@ assign price = target.price | money assign compare_at_price = target.compare_at_price | money + assign has_discount = false -%} - +{% if target.price != target.compare_at_price + and target.price < target.compare_at_price +%} + {% assign has_discount = true %} +{% endif %}
- + {{ price }} - {% if price != compare_at_price %} + {% if has_discount %} {{ compare_at_price }} {% endif %} -
\ No newline at end of file + From fc0608c1d402de5c0e180a719321266799bdfd7b Mon Sep 17 00:00:00 2001 From: Max Tsukanov Date: Mon, 2 Sep 2024 19:07:08 +0300 Subject: [PATCH 2/4] navigate to product from pdp fix --- assets/findify-lazy-loading-pagination.js | 74 ++++++++++++++++------- assets/findify-product-card.js | 5 +- sections/findify-grid-collection.liquid | 4 ++ sections/findify-grid-search.liquid | 6 +- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/assets/findify-lazy-loading-pagination.js b/assets/findify-lazy-loading-pagination.js index bc5dbd5..966afab 100644 --- a/assets/findify-lazy-loading-pagination.js +++ b/assets/findify-lazy-loading-pagination.js @@ -120,40 +120,68 @@ const initFindifyLazyLoadingPagination = ( const productData = sessionStorage.getItem("product"); if (!productData) return; - const id = productData.split(":")[1]; + const parsedProductData = JSON.parse(productData); + const currentUrl = window.location.href; + const { url, id } = parsedProductData; + if (currentUrl == url) { + const product = document.body.querySelector( + `#findify-product-grid>div[product-id=product-${id}]` + ); + const { top, height } = product.getBoundingClientRect(); + + const loader = document.getElementById(selectors.loader); + const paginationContainer = document.querySelector( + `#findify-pagination > .${selectors.paginationContainer}` + ); + + removeLoader(); + + window.scrollTo({ + top: top + window.scrollY - height, + behavior: "smooth", + }); + paginationContainer.parentElement.insertBefore( + loader, + paginationContainer + ); + setTimeout(() => { + sessionStorage.removeItem("product"); + initNextEvents(); + }, 500); + } + }; + + const init = () => { + initPrevButton(); + initNextEvents(); + scrollToProduct(); + }; + init(); +}; + +const initScrollToProductForPagination = () => { + const productData = sessionStorage.getItem("product"); + if (!productData) return; + + const parsedProductData = JSON.parse(productData); + const currentUrl = window.location.href; + const { url, id } = parsedProductData; + + if (currentUrl == url) { const product = document.body.querySelector( `#findify-product-grid>div[product-id=product-${id}]` ); const { top, height } = product.getBoundingClientRect(); - const loader = document.getElementById(selectors.loader); - const paginationContainer = document.querySelector( - `#findify-pagination > .${selectors.paginationContainer}` - ); - - removeLoader(); - window.scrollTo({ top: top + window.scrollY - height, behavior: "smooth", }); - paginationContainer.parentElement.insertBefore( - loader, - paginationContainer - ); + setTimeout(() => { sessionStorage.removeItem("product"); - initNextEvents(); }, 500); - - }; - - const init = () => { - initPrevButton(); - initNextEvents(); - scrollToProduct(); - }; - init(); -}; + } +} diff --git a/assets/findify-product-card.js b/assets/findify-product-card.js index f8e51f1..8c63392 100644 --- a/assets/findify-product-card.js +++ b/assets/findify-product-card.js @@ -26,7 +26,8 @@ const initProductCardAnalytics = (id, properties) => { }; const savePosition = (id, page) => { - sessionStorage.setItem('product', `${page}:${id}`) + const url = window.location.href + sessionStorage.setItem('product', JSON.stringify({id, url, page})) } const initOnProductCardClick = (id, page, properties) => { @@ -50,7 +51,7 @@ const setProductUrl = (productCard, url) => { const onSwatchClick = (event, product_url, variant_url, variant_image) => { const targetedSwatch = event.target; - const productCard = targetedSwatch.closest('div[id].findify-product-card'); + const productCard = targetedSwatch.closest('div[id].findify-product-card'); const swatchImage = productCard.querySelector(`.findify-product-swatch-image`); if(targetedSwatch.classList.contains('active')) { diff --git a/sections/findify-grid-collection.liquid b/sections/findify-grid-collection.liquid index 99c4887..1b35fa1 100644 --- a/sections/findify-grid-collection.liquid +++ b/sections/findify-grid-collection.liquid @@ -134,6 +134,10 @@ initFindifyLazyLoadingPagination("{{lazy_loading_pagination_threshold}}"); } + if("{{ use_lazy_loading_pagination }}" == "false") { + initScrollToProductForPagination(); + } + setFindifyIsLoading(false); diff --git a/sections/findify-grid-search.liquid b/sections/findify-grid-search.liquid index d7b53e3..5a777f1 100644 --- a/sections/findify-grid-search.liquid +++ b/sections/findify-grid-search.liquid @@ -192,6 +192,10 @@ initFindifyLazyLoadingPagination("{{lazy_loading_pagination_threshold}}"); } + if("{{ use_lazy_loading_pagination }}" == "false") { + initScrollToProductForPagination(); + } + setFindifyIsLoading(false); } else { const id = "{{ recommendation_id }}"; @@ -214,7 +218,7 @@ findify.core.init.then(() => { initRecommendation(); - window.addEventListener('popstate', () => { + window.addEventListener('popstate', () => { initRecommendation(); }); }); From 962260d451573215443be0d02b75632008659ad1 Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Mon, 9 Sep 2024 13:28:20 +0300 Subject: [PATCH 3/4] updated classes --- assets/findify-product-card.css | 12 ++++++------ sections/findify-product-card.liquid | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/findify-product-card.css b/assets/findify-product-card.css index 0b634c6..8219e9c 100644 --- a/assets/findify-product-card.css +++ b/assets/findify-product-card.css @@ -1,5 +1,5 @@ -a:not(.button), -a:visited:not(.button) { +.findify-product-link:not(.button), +.findify-product-link:visited:not(.button) { text-decoration: none; color: unset; } @@ -44,20 +44,20 @@ a:visited:not(.button) { color: var(--findify-text-secondary-color); } -.image-container { +.findify-image-container { position: relative; padding-top: var(--findify-product-card-aspect-ratio); display: inline-block; width: 100%; } -.image-container img { +.findify-image-container img { position: absolute; top: 0; left: 0; height: 100%; } -.image-container .second-image { +.findify-image-container .findify-second-image { display: none; position: absolute; top: 0; @@ -65,7 +65,7 @@ a:visited:not(.button) { z-index: 1; } -.image-container:hover .second-image { +.findify-image-container:hover .findify-second-image { display: inline; } diff --git a/sections/findify-product-card.liquid b/sections/findify-product-card.liquid index 1301de9..e9110bb 100644 --- a/sections/findify-product-card.liquid +++ b/sections/findify-product-card.liquid @@ -9,7 +9,7 @@ {% endif %}>
-
+
{% if current_variant.featured_media != null %} {% render 'findify-product-image' , media: current_variant.featured_media @@ -22,7 +22,7 @@ {%- if product.media[1] != null and showHoverImage == 'true' -%} {% render 'findify-product-image' , media: product.media[1] - , class: 'second-image' %} + , class: 'findify-second-image' %} {%- endif -%} {% comment %} {% endcomment %} From 49d1ea8dbc47f630db6913aa10aad1d33a536f64 Mon Sep 17 00:00:00 2001 From: Sipkao Date: Tue, 10 Sep 2024 09:28:35 +0100 Subject: [PATCH 4/4] Version 2024-09-01 --- snippets/findify-head-injector.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/findify-head-injector.liquid b/snippets/findify-head-injector.liquid index 231e60d..403ca31 100644 --- a/snippets/findify-head-injector.liquid +++ b/snippets/findify-head-injector.liquid @@ -19,7 +19,7 @@