modules/blockcart/ajax-cart.js
// try to expand the cart
expand : function(){
if ($('#cart_block_list').hasClass('collapsed'))
{
$('#cart_block_summary').slideUp(200, function(){
$(this).addClass('collapsed').removeClass('expanded');
$('#cart_block_list').slideDown({
duration: 450,
complete: function(){$(this).addClass('expanded').removeClass('collapsed');}
});
});
// toogle the button expand/collapse button
$('#block_cart_expand').fadeOut('slow', function(){
$('#block_cart_collapse').fadeIn('fast');
});
// save the expand statut in the user cookie
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseDir + 'modules/blockcart/blockcart-set-collapse.php' + '?rand=' + new Date().getTime(),
async: true,
cache: false,
data: 'ajax_blockcart_display=expand'
});
}
},
// Fix display when using back and previous browsers buttons
refresh : function(){
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseUri + '?rand=' + new Date().getTime(),
async: true,
cache: false,
dataType : "json",
data: 'controller=cart&ajax=true&token=' + static_token,
success: function(jsonData)
{
ajaxCart.updateCart(jsonData);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
}
});
},
// try to collapse the cart
collapse : function(){
if ($('#cart_block_list').hasClass('expanded'))
{
$('#cart_block_list').slideUp('slow', function(){
$(this).addClass('collapsed').removeClass('expanded');
$('#cart_block_summary').slideDown(450, function(){
$(this).addClass('expanded').removeClass('collapsed');
});
});
$('#block_cart_collapse').fadeOut('slow', function(){
$('#block_cart_expand').fadeIn('fast');
});
// save the expand statut in the user cookie
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseDir + 'modules/blockcart/blockcart-set-collapse.php' + '?rand=' + new Date().getTime(),
async: true,
cache: false,
data: 'ajax_blockcart_display=collapse' + '&rand=' + new Date().getTime()
});
}
},