попробуйте вот так, для отладки так же после success: function(json) { вставьте console.log(json) и посмотрите приходит ли count
success: function(json) {
$('.alert, .text-danger').remove();
if (json['redirect']) {
location = json['redirect'];
}
if (json['success']) {
$('#content').parent().before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>');
// Need to set timeout otherwise it wont update the total
setTimeout(function () {
if (json['count']) {
$('#cart > button').html('<span id="cart-total"><i class="den-fa fa-shopping-cart"></i> ' + json['count'] + '</span>');
} else {
$('#cart > button').html('<span id="cart-total"><i class="den-fa fa-shopping-cart"></i>0</span>');
}
}, 100);
$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}