forked from PrestaShop/hummingbird
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct-cover-thumbnails.tpl
More file actions
174 lines (160 loc) · 7.17 KB
/
product-cover-thumbnails.tpl
File metadata and controls
174 lines (160 loc) · 7.17 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
{**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*}
<div class="product__images js-images-container">
{if $product.images|@count > 0}
<div
id="product-images-{$product.id}"
class="product__carousel carousel slide js-product-carousel"
>
{include file='catalog/_partials/product-flags.tpl'}
<div class="carousel-inner">
{block name='product_cover'}
{foreach from=$product.images item=image key=key name=productImages}
<div class="carousel-item{if $image.id_image == $product.default_image.id_image} active{/if}">
<picture>
{if isset($image.bySize.default_xl.sources.avif)}
<source
srcset="
{$image.bySize.default_xl.sources.avif} 400w,
{$image.bySize.product_main.sources.avif} 720w"
sizes="(min-width: 992px) 50vw, (min-width: 360px) 33vw, 100vw"
type="image/avif"
>
{/if}
{if isset($image.bySize.default_xl.sources.webp)}
<source
srcset="
{$image.bySize.default_xl.sources.webp} 400w,
{$image.bySize.product_main.sources.webp} 720w"
sizes="(min-width: 992px) 50vw, (min-width: 360px) 33vw, 100vw"
type="image/webp"
>
{/if}
<img
class="img-fluid w-100"
srcset="
{$image.bySize.default_xl.url} 400w,
{$image.bySize.product_main.url} 720w"
sizes="(min-width: 992px) 50vw, (min-width: 360px) 33vw, 100vw"
src="{$image.bySize.product_main.url}"
width="{$image.bySize.product_main.width}"
height="{$image.bySize.product_main.height}"
{if $smarty.foreach.productImages.first}
fetchpriority="high"
{else}
loading="lazy"
{/if}
alt="{$image.legend}"
title="{$image.legend}"
data-full-size-image-url="{$image.bySize.home_default.url}"
>
</picture>
</div>
{/foreach}
{/block}
</div>
{if $product.images|@count > 1}
<button class="carousel-control-prev outline outline--rounded" type="button" data-bs-target="#product-images-{$product.id}" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">{l s='Previous image' d='Shop.Theme.Global'}</span>
</button>
<button class="carousel-control-next outline outline--rounded" type="button" data-bs-target="#product-images-{$product.id}" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">{l s='Next image' d='Shop.Theme.Global'}</span>
</button>
{/if}
{block name='product_images_modal_button'}
<button class="product__zoom btn btn-tertiary outline outline--rounded btn-square-icon" data-bs-toggle="modal" data-bs-target="#product-modal" aria-label="{l s='Open zoomed product image gallery' d='Shop.Theme.Global'}" title="{l s='Open zoomed product image gallery' d='Shop.Theme.Global'}">
<i class="material-icons"></i>
</button>
{/block}
</div>
{block name='product_images'}
<div class="product__thumbnails">
<ul class="product__thumbnails-list">
{foreach from=$product.images item=image key=key name=productThumbnails}
<button
class="product__thumbnail focus-ring js-thumb-container{if $image.id_image == $product.default_image.id_image} active{/if}"
data-bs-target="#product-images-{$product.id}"
data-bs-slide-to="{$key}"
{if $image.id_image == $product.default_image.id_image}
aria-current="true"
{/if}
aria-label="{l s='Slide to product image %number%' d='Shop.Theme.Catalog' sprintf=['%number%' => $key + 1]}"
>
<picture>
{if isset($image.bySize.default_xs.sources.avif)}
<source
srcset="
{$image.bySize.default_xs.sources.avif},
{$image.bySize.default_xl.sources.avif} 2x"
type="image/avif"
>
{/if}
{if isset($image.bySize.default_xs.sources.webp)}
<source
srcset="
{$image.bySize.default_xs.sources.webp},
{$image.bySize.default_xl.sources.webp} 2x"
type="image/webp"
>
{/if}
<img
class="product__thumbnail-image outline outline--rounded img-fluid js-thumb{if $image.id_image == $product.default_image.id_image} js-thumb-selected{/if}"
srcset="
{$image.bySize.default_xs.url},
{$image.bySize.default_xl.url} 2x"
width="{$image.bySize.default_xs.width}"
height="{$image.bySize.default_xs.height}"
loading="lazy"
alt="{$image.legend}"
title="{$image.legend}"
>
</picture>
</button>
{/foreach}
</ul>
</div>
{/block}
{hook h='displayAfterProductThumbs' product=$product}
{else}
<picture>
{if isset($urls.no_picture_image.bySize.default_xl.sources.avif)}
<source
srcset="
{$urls.no_picture_image.bySize.default_xl.sources.avif} 400w,
{$urls.no_picture_image.bySize.product_main.sources.avif} 720w"
sizes="(min-width: 992px) 50vw, (min-width: 360px) 33vw, 100vw"
type="image/avif"
>
{/if}
{if isset($urls.no_picture_image.bySize.default_xl.sources.webp)}
<source
srcset="
{$urls.no_picture_image.bySize.default_xl.sources.webp} 400w,
{$urls.no_picture_image.bySize.product_main.sources.webp} 720w"
sizes="(min-width: 992px) 50vw, (min-width: 360px) 33vw, 100vw"
type="image/webp"
>
{/if}
<img
class="img-fluid"
srcset="
{$urls.no_picture_image.bySize.default_xl.url} 400w,
{$urls.no_picture_image.bySize.product_main.url} 720w"
sizes="(min-width: 992px) 50vw, (min-width: 360px) 33vw, 100vw"
width="{$urls.no_picture_image.bySize.product_main.width}"
height="{$urls.no_picture_image.bySize.product_main.height}"
src="{$urls.no_picture_image.bySize.default_xl.url}"
loading="lazy"
alt="{l s='No image available' d='Shop.Theme.Catalog'}"
title="{l s='No image available' d='Shop.Theme.Catalog'}"
>
</picture>
{/if}
{block name='product_images_modal'}
{include file='catalog/_partials/product-images-modal.tpl'}
{/block}
</div>