I am working on a site where the Ajax add-to-cart function was commented out so that the add to cart action would take the shopper directly to the BASK page. They want to now change back to using the Ajax function, but it's not working. I have compared the source code against the demo site, and everything looks fine, but on the site I'm working on, I'm getting a console error: "ReferenceError: productID is not defined", I believe from this function. The site is using Magic Zoom, but the #js-main-image-zoom span exists as does the #js-thumbnails div. Any ideas?
Code:
// ---- Open Product Image Gallery ---- // cornerstoneUX.sharedFunctions.productGallery($('#js-main-image-zoom')); var mainImageZoom = $('#js-main-image-zoom'), thumbnails = $('#js-thumbnails'); console.log(window['image_data' + productID][0]['image_data'][2]); thumbnails.on('click', 'div', function () { var thumbnailIndex = $(this).attr('data-index'); mainImageZoom.attr('data-index', thumbnailIndex); }); $.ajax({ cache: true, crossDomain: true, dataType: 'script', url: '../js/jquery.slick.min.js' }).done(function () { $('#js-thumbnails').slick({ draggable: false, slide: 'img', slidesToScroll: 4, slidesToShow: 4, responsive: [ { breakpoint: 1040, settings: { slidesToScroll: 3, slidesToShow: 3 } }, { breakpoint: 608, settings: { slidesToScroll: 2, slidesToShow: 2 } } ] }); });
Comment