From 397fa73d2d0566101d69ccea67225a87110fe8e6 Mon Sep 17 00:00:00 2001 From: Patryk Tomczyk <13100280+patzick@users.noreply.github.com> Date: Fri, 8 Mar 2019 12:21:23 +0100 Subject: [PATCH 1/5] remove setting offline image --- core/modules/catalog/helpers/index.ts | 6 ------ core/modules/catalog/store/product/actions.ts | 4 ---- 2 files changed, 10 deletions(-) diff --git a/core/modules/catalog/helpers/index.ts b/core/modules/catalog/helpers/index.ts index f7be496fcf..411f42c004 100644 --- a/core/modules/catalog/helpers/index.ts +++ b/core/modules/catalog/helpers/index.ts @@ -474,12 +474,6 @@ export function configureProductAsync (context, { product, configuration, select desiredProductFound = true } - if (typeof navigator !== 'undefined') { - if (selectedVariant && !navigator.onLine && context.state.offlineImage) { // this is fix for not preloaded images for offline - selectedVariant.image = context.state.offlineImage - Logger.debug('Image offline fallback to ', context.state.offlineImage)() - } - } if (selectedVariant) { if (!desiredProductFound) { // update the configuration populateProductConfigurationAsync(context, { product: product, selectedVariant: selectedVariant }) diff --git a/core/modules/catalog/store/product/actions.ts b/core/modules/catalog/store/product/actions.ts index e9cf907a2b..936b2a1f3d 100644 --- a/core/modules/catalog/store/product/actions.ts +++ b/core/modules/catalog/store/product/actions.ts @@ -578,10 +578,6 @@ const actions: ActionTree = { // get original product const productOriginal = context.getters.productOriginal - if (!context.state.offlineImage) { - context.state.offlineImage = productThumbnailPath(productOriginal ? productOriginal /** in case if it's not yet set */ : productVariant, true) - Logger.debug('Image offline fallback set to ' + context.state.offlineImage, 'product')() - } // check if passed variant is the same as original const productUpdated = Object.assign({}, productOriginal, productVariant) populateProductConfigurationAsync(context, { product: productUpdated, selectedVariant: productVariant }) From b340a7a2e380501de982a4b16b9db1be4e05bc78 Mon Sep 17 00:00:00 2001 From: Patryk Tomczyk <13100280+patzick@users.noreply.github.com> Date: Fri, 8 Mar 2019 13:26:32 +0100 Subject: [PATCH 2/5] add error fallback for images --- core/modules/catalog/helpers/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/catalog/helpers/index.ts b/core/modules/catalog/helpers/index.ts index 411f42c004..3d90010dcf 100644 --- a/core/modules/catalog/helpers/index.ts +++ b/core/modules/catalog/helpers/index.ts @@ -531,6 +531,7 @@ export function getMediaGallery (product) { mediaGallery.push({ 'src': getThumbnailPath(mediaItem.image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height), 'loading': getThumbnailPath(mediaItem.image, 310, 300), + 'error': getThumbnailPath(mediaItem.image, 310, 300), 'video': mediaItem.vid }) } @@ -556,6 +557,7 @@ export function configurableChildrenImages(product) { configurableChildrenImages.push({ 'src': getThumbnailPath(groupedByAttribute[confChild][0].image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height), 'loading': getThumbnailPath(groupedByAttribute[confChild][0].image, 310, 300), + 'error': getThumbnailPath(groupedByAttribute[confChild][0].image, 310, 300), 'id': confChild }) } @@ -577,7 +579,8 @@ export function attributeImages(product) { if(product[attribute]) { attributeImages.push({ 'src': getThumbnailPath(product[attribute], rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height), - 'loading': getThumbnailPath(product[attribute], 310, 300) + 'loading': getThumbnailPath(product[attribute], 310, 300), + 'error': getThumbnailPath(product[attribute], 310, 300) }) } } From ad0c60d4c9f5e045f90284b751c358e1b4a8ecf4 Mon Sep 17 00:00:00 2001 From: Patryk Tomczyk <13100280+patzick@users.noreply.github.com> Date: Mon, 11 Mar 2019 16:19:27 +0100 Subject: [PATCH 3/5] test gallery carousel change --- .../components/core/ProductGallery.vue | 4 +- .../core/ProductGalleryCarousel.vue | 71 +++++++++++++++++-- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/src/themes/default/components/core/ProductGallery.vue b/src/themes/default/components/core/ProductGallery.vue index 3b0ecb4285..fef0aa01d1 100644 --- a/src/themes/default/components/core/ProductGallery.vue +++ b/src/themes/default/components/core/ProductGallery.vue @@ -1,6 +1,6 @@