if in product page i click on "add to cart" button, animation work fine but the cart subtotal (in header) doesnt' update on click: i've to refresh the entire page to update subtotal.
Added line in header.php:
Code: Select all
$this->data['subtotal'] = $this->currency->format($this->cart->getTotal());
Code: Select all
<script type="text/javascript"><!--
$(document).ready(function () {
$('#inserisco_prodotto').replaceWith('<a onclick="" id="inserisco_prodotto" class="middle">' + $('#inserisco_prodotto').html() + '</a>');
$('#inserisco_prodotto').click(function () {
$.ajax({
type: 'post',
url: 'index.php?route=module/cart/callback',
dataType: 'html',
data: $('#product :input'),
success: function (html) {
$('#top_cart .middle').html(html);
},
complete: function () {
var image = $('#image').offset();
var cart = $('#top_cart').offset();
$('#image').before('<img src="' + $('#image').attr('src') + '" id="temp" style="position: absolute; top: ' + image.top + 'px; left: ' + image.left + 'px;" />');
params = {
top : cart.top + 'px',
left : cart.left + 'px',
opacity : 0.0,
width : $('#top_cart').width(),
heigth : $('#top_cart').height()
};
$('#temp').animate(params, 'slow', false, function () {
$('#temp').remove();
});
}
});
});
});
//--></script>
Code: Select all
<div id="top_cart" onclick="location.href='<?php echo $cart; ?>';" style="cursor:pointer;" class="middle">
<p id="top_cart_title">
SPESA ATTUALE
</p>
<p id="top_cart_product">
La tua spesa è di:
</p>
<p id="top_cart_product_number">
<i><?php echo $subtotal; ?></i>
</p>
</div>