I am currently working on a project in Open Cart 1.5.4. I slighty moved the cart into another div without any problems. The thing is on new computers and first time they enter the site it´s not possible for the customer to add a product to cart. If they go into another page and then back it works just fine. The javascript file is loaded properly without any problems.
Hope this explanation explains the problem or bug pretty good.
Thanks in advance.
JAVASCRIPT
function addToCart(product_id, quantity) {
quantity = typeof(quantity) != 'undefined' ? quantity : 1;
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: 'product_id=' + product_id + '&quantity=' + quantity,
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, .information, .error').remove();
if (json['redirect']) {
location = json['redirect'];
}
if (json['success']) {
//$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.success').fadeIn('slow');
try {
$('#cart-total').html(json['total']);
}
catch(err) {
console.log(err.message());
}
$('html, body').animate({ scrollTop: 0 }, 'slow');
$(".heading").animate({backgroundColor: "#FFFFFF"}, 'slow');
$(".cart_arrow").attr("style", "display: block;");
$(".heading").animate({backgroundColor: "#585858"}, 'slow');
}
}
});
}