hugo-shopping-product-catal.../layouts/partials/products/list/product-list-item.html

33 lines
1.7 KiB
HTML
Raw Normal View History

2018-05-12 08:44:45 +02:00
<a class="col-6 col-lg-3" href="{{ .RelPermalink }}" style="color: inherit;">
<img class="b-lazy img-fluid text-center" data-src="{{ .Params.thumbnailImage | absURL }}" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" />
2018-05-12 08:44:45 +02:00
<p class="text-left">
<span style="font-size: 13px">{{ .Params.title }}</span>
<br/>
<span style="font-size: 16px">
{{ 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")}} <span class="font-weight-bold">— Sold Out</span> {{ end }}
2018-05-12 08:44:45 +02:00
</span>
</p>
</a>