// data-id-product instead of using rel tag
This commit is contained in:
@@ -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();
|
||||
});
|
||||
@@ -130,7 +130,7 @@
|
||||
{hook h='displayProductListFunctionalButtons' product=$product}
|
||||
{if isset($comparator_max_item) && $comparator_max_item}
|
||||
<div class="compare">
|
||||
<a href="#" rel="{$product.id_product}" class="addToCompare" onClick="addToCompare('{$product.id_product|intval}'); return false;">{l s='Add to Compare'}</a>
|
||||
<a href="#" data-id-product="{$product.id_product}" class="addToCompare" onClick="addToCompare('{$product.id_product|intval}'); return false;">{l s='Add to Compare'}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<td width="{$width}%" class="ajax_block_product comparison_infos product-block">
|
||||
<div class="remove">
|
||||
<a class="cmp_remove" href="{$link->getPageLink('products-comparison', true)|escape:'html'}" title="{l s='Remove'}" rel="ajax_id_product_{$product->id}"><i class="icon-trash"></i></a>
|
||||
<a class="cmp_remove" href="{$link->getPageLink('products-comparison', true)|escape:'html'}" title="{l s='Remove'}" data-id-product="{$product->id}"><i class="icon-trash"></i></a>
|
||||
</div>
|
||||
<div class="product-image-block">
|
||||
<a href="{$product->getLink()}" title="{$product->name|escape:html:'UTF-8'}" class="product_image" >
|
||||
@@ -115,7 +115,7 @@
|
||||
{if ($product->quantity > 0 OR $product->allow_oosp)}
|
||||
<a
|
||||
class="button ajax_add_to_cart_button btn btn-default"
|
||||
data-id-product="ajax_id_product_{$product->id}"
|
||||
data-id-product="{$product->id}"
|
||||
href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$product->id}&token={$static_token}&add")|escape:'html'}"
|
||||
title="{l s='Add to cart'}">
|
||||
<span>{l s='Add to cart'}</span>
|
||||
|
||||
Reference in New Issue
Block a user