From 60a4bee1c2ba6760e0b4e00b40943725a65ae115 Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Mon, 16 Sep 2024 12:05:20 +0300 Subject: [PATCH 1/4] added last changes from release --- sections/findify-product-card-old.liquid | 20 ++++ sections/findify-product-card.liquid | 77 ++++--------- sections/findify-product-list.liquid | 25 +++++ sections/findify-product.liquid | 4 + snippets/findify-product-card-params.liquid | 113 ++++++++++++++++++++ snippets/findify-product-card.liquid | 66 ++++++++++++ 6 files changed, 247 insertions(+), 58 deletions(-) create mode 100644 sections/findify-product-card-old.liquid create mode 100644 sections/findify-product-list.liquid create mode 100644 sections/findify-product.liquid create mode 100644 snippets/findify-product-card-params.liquid create mode 100644 snippets/findify-product-card.liquid diff --git a/sections/findify-product-card-old.liquid b/sections/findify-product-card-old.liquid new file mode 100644 index 0000000..99fe7d1 --- /dev/null +++ b/sections/findify-product-card-old.liquid @@ -0,0 +1,20 @@ +{%- liquid + assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: "\/", "/" | replace: "\u0026", "&" + assign findify_product = page_url | split: "sections=findify-product-card&" | last + include 'findify-product-card-params' +-%} + +{%- render 'findify-product-card' + , id: id + , class: class + , widget: widget + , page: page + , product_url: product_url + , current_variant: current_variant, + , product: product, + , showHoverImage: showHoverImage + , brand: brand, + , reviews: reviews + , reviews_count: reviews_count + , selected_variant_id: selected_variant_id +-%} \ No newline at end of file diff --git a/sections/findify-product-card.liquid b/sections/findify-product-card.liquid index ac12986..7acb3c6 100644 --- a/sections/findify-product-card.liquid +++ b/sections/findify-product-card.liquid @@ -1,59 +1,20 @@ -{%- include 'findify-product-card-connector' -%} +{%- liquid + assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: "\/", "/" | replace: "\u0026", "&" + assign findify_product = page_url | split: "sections=findify-product-card&" | last + include 'findify-product-card-params' +-%} -
- -
-
- {% if current_variant.featured_media != null %} - {% render 'findify-product-image', media: current_variant.featured_media, class: 'first-image' %} - {% else %} - {% render 'findify-product-image', media: product.featured_media, class: 'first-image' %} - {% endif %} - {%- if product.media[1] != null and showHoverImage == 'true' -%} - {% render 'findify-product-image', media: product.media[1], class: 'findify-second-image' %} - {%- endif -%} - - {% comment %} {% endcomment %} -
-
-
- {% if brand %} -
{{ brand }}
- {% endif %} - - {% comment %} - {% render 'findify-product-swatches-color', - product_url: product_url, - product: product, - colormap: colormap, - variants: variants, - %} - {% endcomment %} - -
- -
- {% render 'findify-product-price', product: product %} - {% if reviews %} - {% render 'findify-rating', value: reviews, count: reviews_count %} - {% endif %} -
-
- - -
+{%- render 'findify-product-card' + , id: id + , class: class + , widget: widget + , page: page + , product_url: product_url + , current_variant: current_variant, + , product: product, + , showHoverImage: showHoverImage + , brand: brand, + , reviews: reviews + , reviews_count: reviews_count + , selected_variant_id: selected_variant_id +-%} \ No newline at end of file diff --git a/sections/findify-product-list.liquid b/sections/findify-product-list.liquid new file mode 100644 index 0000000..97a077c --- /dev/null +++ b/sections/findify-product-list.liquid @@ -0,0 +1,25 @@ +{%- liquid + assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: "\/", "/" | replace: "\u0026", "&" + assign findify_product_list_params = page_url | split: "sections=findify-product-list&" | last | url_decode | replace: 'ç', '&' + assign findify_product_list = findify_product_list_params | split: "§" +-%} + +
+ {% for findify_product in findify_product_list %} + {% include 'findify-product-card-params' %} + {%- render 'findify-product-card' + , id: id + , class: class + , widget: widget + , page: page + , product_url: product_url + , current_variant: current_variant, + , product: product, + , showHoverImage: showHoverImage + , brand: brand, + , reviews: reviews + , reviews_count: reviews_count + , selected_variant_id: selected_variant_id +-%} + {% endfor %} +
\ No newline at end of file diff --git a/sections/findify-product.liquid b/sections/findify-product.liquid new file mode 100644 index 0000000..6878b15 --- /dev/null +++ b/sections/findify-product.liquid @@ -0,0 +1,4 @@ +{% liquid + assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: "\/", "/" | replace: "\u0026", "&" | replace: '%7C', '|' | replace: '%20', ' ' + assign query_parameters = page_url | split: "sections=findify-product-list&" | last +%} \ No newline at end of file diff --git a/snippets/findify-product-card-params.liquid b/snippets/findify-product-card-params.liquid new file mode 100644 index 0000000..d266dc0 --- /dev/null +++ b/snippets/findify-product-card-params.liquid @@ -0,0 +1,113 @@ +{%- liquid + # Product template settings + if findify_product contains "class=" + assign class = findify_product | split: "class=" | last | split: "&" | first + endif + assign widget = findify_product | split: "widget=" | last | split: "&" | first + + # Product Collection Slot + if findify_product contains "collectionSlot=" + assign collection_slot = findify_product | split: "collectionSlot=" | last | split: "&" | first + endif + # Product Show Hover Image + if findify_product contains "showHoverImage=" + assign showHoverImage = findify_product | split: "showHoverImage=" | last | split: "&" | first + endif + + # Product metadata + assign colormap = findify_product | split: "colormap=" | last | split: "&" | first | split: ';' + assign position = findify_product | split: "position=" | last | split: "&" | first + assign page = page_url | split: 'page=' | last | split: '&' | first | plus: 0 + + if findify_product contains "handler=" + assign handler = findify_product | split: "handler=" | last | split: "&" | first | url_decode + assign product = all_products[handler] + endif + + # Product Findify variants fields + if findify_product contains "variants=" + assign variants_parameters = findify_product | split: "variants=" | last | split: "&" | first + assign variants = variants_parameters | url_decode | split: "^" + # for variant in variants and then parse and assign values + + # Variants may have same property as products, and so "regexes" may conflict picking wrong values, removing variants from here + assign variants_whole_block = "variants=" | append: variants_parameters + assign findify_product_splitted_by_variants = findify_product | split: variants_whole_block + assign findify_product_leftside = findify_product_splitted_by_variants[0] + assign findify_product_rightside = findify_product_splitted_by_variants[1] | replace_first: "&", "" + assign findify_product = findify_product_leftside | append: findify_product_rightside + endif + + # Product Findify fields + if findify_product contains "availability=" + assign availability = findify_product | split: "availability=" | last | split: "&" | first + endif + if findify_product contains "color=" + assign colors = findify_product | split: "color=" | last | split: "&" | first | url_decode | split: ";" + endif + if findify_product contains "selected_variant_id=" + assign selected_variant_id = findify_product | split: "selected_variant_id=" | last | split: "&" | first + for variant in product.variants + assign current_variant_id_number = selected_variant_id | plus: 0 + if variant.id == current_variant_id_number + assign current_variant = variant + endif + endfor + endif + if findify_product contains "item_group_id=" + assign item_group_id = findify_product | split: "item_group_id=" | last | split: "&" | first + endif + if findify_product contains "id=" + assign id = findify_product | split: "id=" | last | split: "&" | first + endif + if findify_product contains "category=" + assign category = findify_product | split: "category=" | last | split: "&" | first | url_decode + endif + if findify_product contains "price=" + assign price = findify_product | split: "price=" | last | split: "&" | first + endif + # Manipulating product.url to add variant and collection awareness with locale awareness + if product.url contains "?" + assign product_url_dto = product.url | append: "&variant=" | append: selected_variant_id + else + assign product_url_dto = product.url | append: "?variant=" | append: selected_variant_id + endif + if product_url_dto contains routes.root_url and routes.root_url != '/' + assign product_url_dto = product_url_dto | replace: routes.root_url, '' + endif + assign product_url = routes.root_url | append: collection_slot | append: product_url_dto | replace: '//', '/' + if findify_product contains "quantity=" + assign quantity = findify_product | split: "quantity=" | last | split: "&" | first + endif + if findify_product contains "size=" + assign sizes = findify_product | split: "size=" | last | split: "&" | first | split: "^" | url_decode + endif + if findify_product contains "sku=" + assign sku = findify_product | split: "sku=" | last | split: "&" | first + endif + if findify_product contains "tags=" + assign tags = findify_product | split: "tags=" | last | split: "&" | first + endif + if findify_product contains "stickers=" + assign stickers = findify_product | split: "stickers=" | last | split: "&" | first + endif + if findify_product contains "reviews.count=" + assign reviews_count = findify_product | split: "reviews.count=" | last | split: "&" | first + endif + if findify_product contains "reviews.average_score=" + assign reviews = findify_product | split: "reviews.average_score=" | last | split: "&" | first + endif + if findify_product contains "brand=" + assign brand = findify_product | split: "brand=" | last | split: "&" | first | url_decode + endif + if findify_product contains "title=" + assign title = findify_product | split: "title=" | last | split: "&" | first | url_decode + endif + # Product Findify custom fields + if findify_product contains "custom_fields=" + assign custom_fields = findify_product | split: "custom_fields=" | last | split: "&" | first + # if custom_fields contains "example_field" + # assign example_field = custom_fields | split: "example_field=" | last | split: "~" | first | url_decode + # endif + endif +-%} \ No newline at end of file diff --git a/snippets/findify-product-card.liquid b/snippets/findify-product-card.liquid new file mode 100644 index 0000000..619cf9e --- /dev/null +++ b/snippets/findify-product-card.liquid @@ -0,0 +1,66 @@ +
+ +
+
+ {% if current_variant.featured_media != null %} + {% render 'findify-product-image' + , media: current_variant.featured_media + , class: 'first-image' %} + {% else %} + {% render 'findify-product-image' + , media: product.featured_media + , class: 'first-image' %} + {% endif %} + {%- if product.media[1] != null and showHoverImage == 'true' -%} + {% render 'findify-product-image' + , media: product.media[1] + , class: 'findify-second-image' %} + {%- endif -%} + + {% comment %} {% endcomment %} +
+
+
+ {% if brand %} +
{{ brand }}
+ {% endif %} + + {% comment %} {% render 'findify-product-swatches-color', + product_url: product_url, + product: product, + colormap: colormap, + variants: variants, + %} {% endcomment %} + + +
+ +
+ {% render 'findify-product-price' + , product: product %} + {% if reviews %} + {% render 'findify-rating' + , value: reviews + , count: reviews_count %} + {% endif %} +
+
+ + + + +
\ No newline at end of file From f9e5f83dea440c9ee3ff7a3550a5806ca22e2f77 Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Mon, 16 Sep 2024 12:11:27 +0300 Subject: [PATCH 2/4] deleted old file --- sections/findify-product-card-old.liquid | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 sections/findify-product-card-old.liquid diff --git a/sections/findify-product-card-old.liquid b/sections/findify-product-card-old.liquid deleted file mode 100644 index 99fe7d1..0000000 --- a/sections/findify-product-card-old.liquid +++ /dev/null @@ -1,20 +0,0 @@ -{%- liquid - assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: "\/", "/" | replace: "\u0026", "&" - assign findify_product = page_url | split: "sections=findify-product-card&" | last - include 'findify-product-card-params' --%} - -{%- render 'findify-product-card' - , id: id - , class: class - , widget: widget - , page: page - , product_url: product_url - , current_variant: current_variant, - , product: product, - , showHoverImage: showHoverImage - , brand: brand, - , reviews: reviews - , reviews_count: reviews_count - , selected_variant_id: selected_variant_id --%} \ No newline at end of file From 4daa88ba4224cb71367411e6beede7a32b8aa3bb Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Mon, 16 Sep 2024 12:20:36 +0300 Subject: [PATCH 3/4] added div --- snippets/findify-product-card.liquid | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/findify-product-card.liquid b/snippets/findify-product-card.liquid index 786f6ac..8936ba6 100644 --- a/snippets/findify-product-card.liquid +++ b/snippets/findify-product-card.liquid @@ -62,5 +62,4 @@ initOnProductCardClick(id, page, { widget, selected_variant_id }); - - + \ No newline at end of file From 77b5ee345b532bb0971f1efc14a02574f0ff401a Mon Sep 17 00:00:00 2001 From: rozhnovaYana Date: Mon, 16 Sep 2024 12:26:28 +0300 Subject: [PATCH 4/4] removed old file --- sections/findify-product.liquid | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 sections/findify-product.liquid diff --git a/sections/findify-product.liquid b/sections/findify-product.liquid deleted file mode 100644 index 6878b15..0000000 --- a/sections/findify-product.liquid +++ /dev/null @@ -1,4 +0,0 @@ -{% liquid - assign page_url = content_for_header | split: '"pageurl":"' | last | split: '"' | first | split: request.host | last | replace: "\/", "/" | replace: "\u0026", "&" | replace: '%7C', '|' | replace: '%20', ' ' - assign query_parameters = page_url | split: "sections=findify-product-list&" | last -%} \ No newline at end of file