From 2e7e823fe5e88eddf15b75f9c87f851a3b0a01c1 Mon Sep 17 00:00:00 2001 From: Hlavtox Date: Thu, 2 Feb 2023 22:18:41 +0100 Subject: [PATCH] Implement picture tags --- .../catalog/_partials/category-header.tpl | 6 +- .../catalog/_partials/miniatures/category.tpl | 18 ++-- .../_partials/miniatures/pack-product.tpl | 32 +++++--- .../catalog/_partials/miniatures/product.tpl | 36 ++++---- .../_partials/product-cover-thumbnails.tpl | 82 +++++++++++-------- .../_partials/product-images-modal.tpl | 64 +++++++++------ templates/catalog/_partials/subcategories.tpl | 18 ++-- .../_partials/cart-detailed-product-line.tpl | 12 ++- .../_partials/cart-summary-product-line.tpl | 12 ++- .../_partials/order-confirmation-table.tpl | 12 ++- templates/cms/stores.tpl | 22 +++-- 11 files changed, 197 insertions(+), 117 deletions(-) diff --git a/templates/catalog/_partials/category-header.tpl b/templates/catalog/_partials/category-header.tpl index 3a85aa81..e37056f4 100644 --- a/templates/catalog/_partials/category-header.tpl +++ b/templates/catalog/_partials/category-header.tpl @@ -32,7 +32,11 @@ {/if} {if !empty($category.image.large.url)}
- {if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if} + + {if !empty($category.image.large.sources.avif)}{/if} + {if !empty($category.image.large.sources.webp)}{/if} + {if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if} +
{/if} diff --git a/templates/catalog/_partials/miniatures/category.tpl b/templates/catalog/_partials/miniatures/category.tpl index f9dfe509..ffefa43f 100644 --- a/templates/catalog/_partials/miniatures/category.tpl +++ b/templates/catalog/_partials/miniatures/category.tpl @@ -25,13 +25,17 @@ {block name='category_miniature_item'}
- {if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if} + + {if !empty($category.image.medium.sources.avif)}{/if} + {if !empty($category.image.medium.sources.webp)}{/if} + {if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if} +

diff --git a/templates/catalog/_partials/miniatures/pack-product.tpl b/templates/catalog/_partials/miniatures/pack-product.tpl index 7ddae4fb..9967546e 100644 --- a/templates/catalog/_partials/miniatures/pack-product.tpl +++ b/templates/catalog/_partials/miniatures/pack-product.tpl @@ -30,19 +30,27 @@ diff --git a/templates/catalog/_partials/miniatures/product.tpl b/templates/catalog/_partials/miniatures/product.tpl index faf86109..234fda9f 100644 --- a/templates/catalog/_partials/miniatures/product.tpl +++ b/templates/catalog/_partials/miniatures/product.tpl @@ -30,23 +30,31 @@ {block name='product_thumbnail'} {if $product.cover} - {if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{/if} + + {if !empty($product.cover.bySize.home_default.sources.avif)}{/if} + {if !empty($product.cover.bySize.home_default.sources.webp)}{/if} + {if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{/if} + {else} - + + {if !empty($urls.no_picture_image.bySize.home_default.sources.avif)}{/if} + {if !empty($urls.no_picture_image.bySize.home_default.sources.webp)}{/if} + + {/if} {/block} diff --git a/templates/catalog/_partials/product-cover-thumbnails.tpl b/templates/catalog/_partials/product-cover-thumbnails.tpl index 1dcccca9..f9b20f60 100644 --- a/templates/catalog/_partials/product-cover-thumbnails.tpl +++ b/templates/catalog/_partials/product-cover-thumbnails.tpl @@ -26,30 +26,38 @@ {block name='product_cover'}
{if $product.default_image} - {$product.default_image.legend} + + {if !empty($product.default_image.bySize.large_default.sources.avif)}{/if} + {if !empty($product.default_image.bySize.large_default.sources.webp)}{/if} + {$product.default_image.legend} +
search
{else} - + + {if !empty($urls.no_picture_image.bySize.large_default.sources.avif)}{/if} + {if !empty($urls.no_picture_image.bySize.large_default.sources.webp)}{/if} + + {/if}
{/block} @@ -59,21 +67,25 @@
    {foreach from=$product.images item=image}
  • - {$image.legend} + + {if !empty($image.bySize.small_default.sources.avif)}{/if} + {if !empty($image.bySize.small_default.sources.webp)}{/if} + {$image.legend} +
  • {/foreach}
diff --git a/templates/catalog/_partials/product-images-modal.tpl b/templates/catalog/_partials/product-images-modal.tpl index 26a951a4..84666969 100644 --- a/templates/catalog/_partials/product-images-modal.tpl +++ b/templates/catalog/_partials/product-images-modal.tpl @@ -29,20 +29,28 @@ {assign var=imagesCount value=$product.images|count}
{if $product.default_image} - {$product.default_image.legend} + + {if !empty($product.default_image.bySize.large_default.sources.avif)}{/if} + {if !empty($product.default_image.bySize.large_default.sources.webp)}{/if} + {$product.default_image.legend} + {else} - + + {if !empty($urls.no_picture_image.bySize.large_default.sources.avif)}{/if} + {if !empty($urls.no_picture_image.bySize.large_default.sources.webp)}{/if} + + {/if}
{block name='product_description_short'} @@ -56,19 +64,23 @@
    {foreach from=$product.images item=image}
  • - {$image.legend} + + {if !empty($image.medium.sources.avif)}{/if} + {if !empty($image.medium.sources.webp)}{/if} + {$image.legend} +
  • {/foreach}
diff --git a/templates/catalog/_partials/subcategories.tpl b/templates/catalog/_partials/subcategories.tpl index 3f241848..25f4a9e6 100644 --- a/templates/catalog/_partials/subcategories.tpl +++ b/templates/catalog/_partials/subcategories.tpl @@ -33,13 +33,17 @@ diff --git a/templates/checkout/_partials/cart-detailed-product-line.tpl b/templates/checkout/_partials/cart-detailed-product-line.tpl index a0b3a1f7..b21ea037 100644 --- a/templates/checkout/_partials/cart-detailed-product-line.tpl +++ b/templates/checkout/_partials/cart-detailed-product-line.tpl @@ -27,9 +27,17 @@
{if $product.default_image} - {$product.name|escape:'quotes'} + + {if !empty($product.default_image.bySize.cart_default.sources.avif)}{/if} + {if !empty($product.default_image.bySize.cart_default.sources.webp)}{/if} + {$product.name|escape:'quotes'} + {else} - + + {if !empty($urls.no_picture_image.bySize.cart_default.sources.avif)}{/if} + {if !empty($urls.no_picture_image.bySize.cart_default.sources.webp)}{/if} + + {/if}
diff --git a/templates/checkout/_partials/cart-summary-product-line.tpl b/templates/checkout/_partials/cart-summary-product-line.tpl index 2eabef29..8d7fe333 100644 --- a/templates/checkout/_partials/cart-summary-product-line.tpl +++ b/templates/checkout/_partials/cart-summary-product-line.tpl @@ -26,9 +26,17 @@ diff --git a/templates/checkout/_partials/order-confirmation-table.tpl b/templates/checkout/_partials/order-confirmation-table.tpl index ce705869..79dadb46 100644 --- a/templates/checkout/_partials/order-confirmation-table.tpl +++ b/templates/checkout/_partials/order-confirmation-table.tpl @@ -40,9 +40,17 @@
{if !empty($product.default_image)} - + + {if !empty($product.default_image.medium.sources.avif)}{/if} + {if !empty($product.default_image.medium.sources.webp)}{/if} + + {else} - + + {if !empty($urls.no_picture_image.bySize.medium_default.sources.avif)}{/if} + {if !empty($urls.no_picture_image.bySize.medium_default.sources.webp)}{/if} + + {/if}
diff --git a/templates/cms/stores.tpl b/templates/cms/stores.tpl index 5dca39d8..f63fcaa9 100644 --- a/templates/cms/stores.tpl +++ b/templates/cms/stores.tpl @@ -35,15 +35,19 @@
- {$store.image.legend} + + {if !empty($store.image.bySize.stores_default.sources.avif)}{/if} + {if !empty($store.image.bySize.stores_default.sources.webp)}{/if} + {$store.image.legend} +

{$store.name}