diff --git a/exampleSite/content/products/alessa.md b/exampleSite/content/products/alessa.md index 12e75ec..87d43df 100644 --- a/exampleSite/content/products/alessa.md +++ b/exampleSite/content/products/alessa.md @@ -5,9 +5,9 @@ "categories": ["Wall Light"], "images": ["/img/alessa/1.png", "/img/alessa/2.jpg", "/img/alessa/3.jpg", "/img/alessa/4.jpg", "/img/alessa/5.jpg", "/img/alessa/6.jpg"], "thumbnailImage": "/img/alessa/thumnail.png", - "actualPrice": "", - "comparePrice": "", - "inStock": true, + "actualPrice": null, + "comparePrice": null, + "inStock": null, "options": { "Color": ["Chrome", "Green", "White", "Black"], "Size" : ["L19 x W24 x H23cms"] @@ -15,19 +15,19 @@ "variants": [ { "optionCombination" : ["Chrome", "L19 x W24 x H23cms"], - "comparePrice": "", + "comparePrice": null, "actualPrice": "₹ 3,032.00", "inStock": true }, { "optionCombination" : ["Green", "L19 x W24 x H23cms"], - "comparePrice": "", + "comparePrice": null, "actualPrice": "₹ 2,032.00", "inStock": false }, { "optionCombination" : ["Black", "L19 x W24 x H23cms"], - "comparePrice": "", + "comparePrice": null, "actualPrice": "₹ 1,032.00", "inStock": true } diff --git a/exampleSite/content/products/azure-blue-de-stijl-bedside-retro-light-with-black-ring.md b/exampleSite/content/products/azure-blue-de-stijl-bedside-retro-light-with-black-ring.md index ec65214..3fada91 100644 --- a/exampleSite/content/products/azure-blue-de-stijl-bedside-retro-light-with-black-ring.md +++ b/exampleSite/content/products/azure-blue-de-stijl-bedside-retro-light-with-black-ring.md @@ -5,22 +5,22 @@ "categories": ["Wall Light"], "images" : ["/img/azure-blue-de-stijl-bedside-retro-light-with-black-ring/1.jpg"], "thumbnailImage": "/img/azure-blue-de-stijl-bedside-retro-light-with-black-ring/thumbnail.jpg", - "actualPrice": "", - "comparePrice": "", - "inStock": true, + "actualPrice": null, + "comparePrice": null, + "inStock": null, "options": { "Type": ["With extension wire", "Without extension wire"] }, "variants": [ { "optionCombination" : ["With extension wire"], - "comparePrice": "", + "comparePrice": null, "actualPrice": "₹ 2917.00", "inStock": true }, { "optionCombination" : ["Without extension wire"], - "comparePrice": "", + "comparePrice": null, "actualPrice": "₹ 2000.00", "inStock": false } diff --git a/exampleSite/content/products/duke.md b/exampleSite/content/products/duke.md index 5643d0c..336c512 100644 --- a/exampleSite/content/products/duke.md +++ b/exampleSite/content/products/duke.md @@ -6,7 +6,7 @@ "images": ["/img/duke/1.jpg", "/img/duke/2.jpg", "/img/duke/3.jpg"], "thumbnailImage": "/img/duke/thumbnail.jpg", "actualPrice": "₹ 87,341.00", - "comparePrice": "", + "comparePrice": null, "inStock": true, "options": {}, "variants": [] diff --git a/exampleSite/content/products/modo-21-lamp.md b/exampleSite/content/products/modo-21-lamp.md index 1e69e64..8a1c81c 100644 --- a/exampleSite/content/products/modo-21-lamp.md +++ b/exampleSite/content/products/modo-21-lamp.md @@ -6,7 +6,7 @@ "images": ["/img/modo-21-lamp/1.jpg", "/img/modo-21-lamp/2.jpg", "/img/modo-21-lamp/2.jpg"], "thumbnailImage": "/img/modo-21-lamp/thumbnail.jpg", "actualPrice": "₹ 85,000.00", - "comparePrice": "", + "comparePrice": null, "inStock": true, "options": {}, "variants": [] diff --git a/exampleSite/content/products/retro-vintage-industrial-cage-pendant-system.md b/exampleSite/content/products/retro-vintage-industrial-cage-pendant-system.md index 6304104..18d5d32 100644 --- a/exampleSite/content/products/retro-vintage-industrial-cage-pendant-system.md +++ b/exampleSite/content/products/retro-vintage-industrial-cage-pendant-system.md @@ -6,7 +6,7 @@ "images": ["/img/retro-vintage-industrial-cage-pendant-system/1.png", "/img/retro-vintage-industrial-cage-pendant-system/2.png"], "thumbnailImage": "/img/retro-vintage-industrial-cage-pendant-system/thumbnail.png", "actualPrice": "₹ 3,744.00", - "comparePrice": "", + "comparePrice": null, "inStock": true, "options": {}, "variants": [] diff --git a/exampleSite/content/products/void-pendant.md b/exampleSite/content/products/void-pendant.md index dc5e728..48fd4d2 100644 --- a/exampleSite/content/products/void-pendant.md +++ b/exampleSite/content/products/void-pendant.md @@ -5,7 +5,7 @@ "categories": ["Pendant Light"], "images": ["/img/void-pendant/1.jpg", "/img/void-pendant/2.jpg", "/img/void-pendant/3.jpg", "/img/void-pendant/4.jpg"], "thumbnailImage": "/img/void-pendant/thumbnail.jpg", - "comparePrice": "", + "comparePrice": null, "actualPrice": "₹ 18,500.00", "inStock": true, "options": {}, diff --git a/layouts/partials/products/list/product-list-item.html b/layouts/partials/products/list/product-list-item.html index 4a8e8e3..1af5074 100644 --- a/layouts/partials/products/list/product-list-item.html +++ b/layouts/partials/products/list/product-list-item.html @@ -4,8 +4,30 @@ {{ .Params.title }}
- {{ .Params.actualPrice }} {{ if not .Params.inStock }} - — Sold Out {{ end }} + {{ if .Params.actualPrice }} + {{ $.Scratch.Set "minimumPrice" (.Params.actualPrice | string) }} + {{ else }} + {{ $.Scratch.Set "minimumPrice" "999999999999999"}} + {{ end }} + {{ if .Params.inStock }} + {{ $.Scratch.Set "inStock" (.Params.inStock | string) }} + {{ else }} + {{ $.Scratch.Set "inStock" "false" }} + {{ end }} + {{ range .Params.variants }} + {{ $variantActualPrice := (.actualPrice | replaceRE "[^0-9.]+" "" | float ) }} + {{ $actualPrice := ($.Scratch.Get "minimumPrice" | replaceRE "[^0-9.]+" "" | float) }} + {{ if lt $variantActualPrice $actualPrice }} + {{ $.Scratch.Set "minimumPrice" (.actualPrice | string)}} + {{ $.Scratch.Set "isMinimumVariantPrice" "true"}} + {{ end }} + {{ if .inStock }} + {{ $.Scratch.Set "inStock" "true" }} + {{ end }} + {{ end }} + {{ if eq ($.Scratch.Get "isMinimumVariantPrice") "true" }} From {{ end }} + {{ $.Scratch.Get "minimumPrice" }} + {{ if not (eq ($.Scratch.Get "inStock") "true")}} — Sold Out {{ end }}

\ No newline at end of file diff --git a/layouts/partials/products/single/product-single-heading.html b/layouts/partials/products/single/product-single-heading.html index 02e7277..413de88 100644 --- a/layouts/partials/products/single/product-single-heading.html +++ b/layouts/partials/products/single/product-single-heading.html @@ -2,7 +2,7 @@

{{ .Params.comparePrice }} {{ .Params.actualPrice }} - — Sold Out +

{{ range $index, $element := .Params.options }}