Jump to content

Cart quantity not updating!


Recommended Posts

After i made some change in the code the cart block does not change the quantity even after hitting the add to cart button.. but after refresh it shows 1 product in the cart...

this is my demo site link>> 
http://exoticatrust.com/foodjama/index.php?id_category=7&controller=category

try hitting the add to cart button.. there is no change... any help appreciated!!

 

Link to comment
Share on other sites

 

it's probably because your script trying to "animate" add to cart button (image flyting to the cart)

but you haven't got images there, so js script crashes whole js engine.

what to do? 

 

from ajax-cart.js (from block cart module directory)

 

remove this code:

 

// add the picture to the cart

                var $element = $(callerElement).parent().parent().find('a.product_image img,a.product_img_link img');

                if (!$element.length)

                    $element = $('#bigpic');

                var $picture = $element.clone();

                var pictureOffsetOriginal = $element.offset();

                pictureOffsetOriginal.right = $(window).innerWidth() - pictureOffsetOriginal.left - $element.width();

 

                if ($picture.length)

                {

                    $picture.css({

                        position: 'absolute',

                        top: pictureOffsetOriginal.top,

                        right: pictureOffsetOriginal.right

                    });

                }

 

                var pictureOffset = $picture.offset();

                var cartBlock = $('#cart_block');

                if (!$('#cart_block')[0] || !$('#cart_block').offset().top || !$('#cart_block').offset().left)

                    cartBlock = $('#shopping_cart');

                var cartBlockOffset = cartBlock.offset();

                cartBlockOffset.right = $(window).innerWidth() - cartBlockOffset.left - cartBlock.width();

 

                // Check if the block cart is activated for the animation

                if (cartBlockOffset != undefined && $picture.length)

                {

                    $picture.appendTo('body');

                    $picture

                        .css({

                            position: 'absolute',

                            top: pictureOffsetOriginal.top,

                            right: pictureOffsetOriginal.right,

                            zIndex: 4242

                        })

                        .animate({

                            width: $element.attr('width')*0.66,

                            height: $element.attr('height')*0.66,

                            opacity: 0.2,

                            top: cartBlockOffset.top + 30,

                            right: cartBlockOffset.right + 15

                        }, 1000)

                        .fadeOut(100, function() {

                            ajaxCart.updateCartInformation(jsonData, addedFromProductPage);

                            $(this).remove();

                        });

remember about backups!

Link to comment
Share on other sites

×
×
  • Create New...