// data-id-product instead of using rel tag
This commit is contained in:
1 parent
08cb7ee566
commit
33b5327b4d
3 files changed
+13
-12
No files matched your search
@@ -58,11 +58,12 @@ function addToCompare(productId){
|
|||||||
|
|
||||||
function compareButtonsStatusRefresh(){
|
function compareButtonsStatusRefresh(){
|
||||||
$('.addToCompare').each(function() {
|
$('.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');
|
$(this).addClass('checked');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(this).removeClass('checked');
|
$(this).removeClass('checked');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -74,19 +75,19 @@ function totalValue(value) {
|
|||||||
reloadProductComparison = function() {
|
reloadProductComparison = function() {
|
||||||
$('a.cmp_remove').click(function(){
|
$('a.cmp_remove').click(function(){
|
||||||
|
|
||||||
var idProduct = $(this).prop('rel').replace('ajax_id_product_', '');
|
var idProduct = $(this).data('id-product');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct,
|
url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct,
|
||||||
async: false,
|
async: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
success: function(){
|
success: function(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
compareButtonsStatusRefresh();
|
compareButtonsStatusRefresh();
|
||||||
});
|
});
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
{hook h='displayProductListFunctionalButtons' product=$product}
|
{hook h='displayProductListFunctionalButtons' product=$product}
|
||||||
{if isset($comparator_max_item) && $comparator_max_item}
|
{if isset($comparator_max_item) && $comparator_max_item}
|
||||||
<div class="compare">
|
<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>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
<td width="{$width}%" class="ajax_block_product comparison_infos product-block">
|
<td width="{$width}%" class="ajax_block_product comparison_infos product-block">
|
||||||
<div class="remove">
|
<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>
|
||||||
<div class="product-image-block">
|
<div class="product-image-block">
|
||||||
<a href="{$product->getLink()}" title="{$product->name|escape:html:'UTF-8'}" class="product_image" >
|
<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)}
|
{if ($product->quantity > 0 OR $product->allow_oosp)}
|
||||||
<a
|
<a
|
||||||
class="button ajax_add_to_cart_button btn btn-default"
|
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'}"
|
href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$product->id}&token={$static_token}&add")|escape:'html'}"
|
||||||
title="{l s='Add to cart'}">
|
title="{l s='Add to cart'}">
|
||||||
<span>{l s='Add to cart'}</span>
|
<span>{l s='Add to cart'}</span>
|
||||||
|
|||||||
Reference in new issue
Block a user