Skip to content

Commit

Permalink
Fixed replaced image in product page PrestaShop#24983
Browse files Browse the repository at this point in the history
Questions	Answers
Branch?	develop
Description?	with this small code trick ,we can change the replaced image to the newest one immediately the time after the image ajax replaced without the page refresh or reload.
Type?	improvement
Category?	BO
BC breaks?	no
Deprecations?	no
Fixed ticket?	Fixes #{20035}.
How to test?	Just clear your caches and refresh your product v2 page.
Possible impacts?	small change, no other impact.
  • Loading branch information
NoZTurn committed Jun 22, 2021
1 parent 0cc4c4f commit 1048eda
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -494,7 +494,8 @@
const imageElement = document.querySelector(
DropzoneMap.savedImage(newImage.image_id),
);
imageElement.src = newImage.image_url;
const imageUpdateTime = new Date();
imageElement.src = `${newImage.image_url}?${imageUpdateTime.getTime()}`;
$.growl({message: this.$t('window.imageReplaced')});
this.buttonLoading = false;
Expand Down

0 comments on commit 1048eda

Please sign in to comment.