Created
January 5, 2015 18:53
-
-
Save jparbros/955fdb1da3dbe8736f00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.confirmSetted = false; | |
function getAjaxCart() { | |
jQuery.ajax({ | |
url: minicart_url, | |
dataType: 'json', | |
type : 'get', | |
success: function(data){ | |
var div_element = jQuery("<div>"); | |
jQuery(div_element).html(data.html); | |
if( jQuery("#cart-total").length > 0 ) { | |
var cart_total = text_cart_total.replace("%total%", data.summary_qty ); | |
cart_total = cart_total.replace("%price%", data.subtotal ); | |
jQuery("#cart-total").html( cart_total ); | |
} | |
if( jQuery(div_element).find(".block-cart").length > 0){ | |
jQuery('.block-cart').html( jQuery(div_element).find(".block-cart").first().html() ); | |
} | |
if(jQuery('.block-cart .btn-remove').length > 0){ | |
jQuery('.block-cart .btn-remove').attr('onclick','').unbind('click'); | |
jQuery('.block-cart .btn-remove').off("click"); | |
if(window.confirmSetted == true) { | |
jQuery(document).on('click', '.block-cart .btn-remove', function(e){ | |
if(confirm( text_confirm_delete_item )){ | |
deleteItemCart( jQuery(this).attr("href") ); | |
} | |
// return false; | |
}); | |
window.confirmSetted = true | |
} | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment