Welcome to mirror list, hosted at ThFree Co, Russian Federation.

product-list-item.html « list « products « partials « layouts - github.com/kishaningithub/hugo-shopping-product-catalogue-simple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1af5074f770bbd1c3b1e64ff1113dfe5af57f0e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<a class="col-6 col-lg-3" href="{{ .RelPermalink }}" style="color: inherit;">
    <img class="b-lazy img-fluid text-center" data-src="{{ .Params.thumbnailImage }}" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" />
    <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 }}
        </span>
    </p>
</a>