// data-id-product instead of using rel tag

This commit is contained in:
Kevin Granger
2013-12-04 16:58:34 +01:00
parent 08cb7ee566
commit 33b5327b4d
3 changed files with 13 additions and 12 deletions
@@ -58,11 +58,12 @@ function addToCompare(productId){
function compareButtonsStatusRefresh(){
$('.addToCompare').each(function() {
if ($.inArray(parseInt($(this).prop('rel')),comparedProductsIds)!= -1){
console.log($(this).data('id-product'));
if ($.inArray(parseInt($(this).data('id-product')),comparedProductsIds)!= -1){
$(this).addClass('checked');
}
else {
$(this).removeClass('checked');
$(this).removeClass('checked');
}
})
}
@@ -74,19 +75,19 @@ function totalValue(value) {
reloadProductComparison = function() {
$('a.cmp_remove').click(function(){
var idProduct = $(this).prop('rel').replace('ajax_id_product_', '');
var idProduct = $(this).data('id-product');
$.ajax({
url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct,
async: false,
cache: false,
success: function(){
url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct,
async: false,
cache: false,
success: function(){
return true;
}
});
});
});
}
$(document).ready(function() {
compareButtonsStatusRefresh();
compareButtonsStatusRefresh();
});