Announcement

Collapse
No announcement yet.

Ajax Mini-Basket and jsPROD Function Errors

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Ajax Mini-Basket and jsPROD Function Errors

    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
                            }
                        }
                    ]
                });
            });


    #2
    Hi Leanne,

    When is that error generated? The code you posted is for the thumbnails not add to cart so I am confused.
    Matt Zimmermann

    Miva Web Developer
    Alchemy Web Development
    https://www.alchemywebdev.com
    Site Development - Maintenance - Consultation

    Miva Certified Developer
    Miva Professional Developer

    https://www.dev4web.net | Twitter

    Comment


      #3
      It is generated when the product page loads. I know it's not related to the add to cart, but I'm reaching, because I can't see what else would be causing the problem.

      Comment


        #4
        Quick try, since that variable is just in a console display, try removing it.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          But why take a sensible approach when I can bang my head against the wall instead? :)

          I commented out that function in scripts.js and the mini-basket is now working as intended. Thanks!

          Comment


            #6
            I was going to ask if the PROD page had the body id="js-PROD" but have it working.
            Leslie Kirk
            Miva Certified Developer
            Miva Merchant Specialist since 1997
            Previously of Webs Your Way
            (aka Leslie Nord leslienord)

            Email me: [email protected]
            www.lesliekirk.com

            Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

            Comment

            Working...
            X