This code is for an alert pop up message when there is no preview image available for a personalised item(Boulevard website, PTC) in PDP .
code snippet:
setTimeout(function() {
//checking preview available for personalised section.
var existingimage = self.image_normal
var createdimage = $('.pesonalizeimagid').find('img').attr('src');
if(createdimage == existingimage){ //condition for no preview image
$(this).dblclick();
//document.getElementById("preview-and-apply").dblclick();
self.loadScript('https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js', function() {
swal({
title: "",
text: "PREVIEW NOT AVAILABLE FOR THIS SELECTION",
icon: "warning",
confirmButtonColor: 'black',
})
self.render();
})
//alert("PREVIEW NOT AVAILABLE FOR THIS SELECTION");
}
}, 1900);
Note: Here the value of set Timeout function is very important, the pop will appear only after the default image is loaded, so due to rendering of image we need to set the time according to rendering time.