我目前正在開Open Cart 1.5.4的項目中工作。我沒有任何問題輕輕地將購物車轉移到另一個分區。事情是在新電腦上,當他們第一次進入網站時,客戶無法將產品添加到購物車。如果他們進入另一個頁面,然後返回它工作得很好。 JavaScript文件正確加載沒有任何問題。Opencart 1.5.4 addToCart()第一次頁面顯示功能不起作用
希望這個解釋說明問題或bug相當不錯。
在此先感謝。
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');
}
}
});
}
感謝您的答案,但它不是真正的問題的原因,最近發現的問題,這是非www域的地址,我扔在一個htaccess文件 – Ziinloader