[-] FO : #PSFV-803 - Fix bugs with customization and cart summary

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14788 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-04-20 14:55:21 +00:00
parent 33d8a79b0b
commit d4274b6054
5 changed files with 54 additions and 14 deletions
+35 -7
View File
@@ -295,19 +295,24 @@ function deleteProductFromSummary(id)
else
{
$('#product_'+ id).fadeOut('slow', function() {
$(this).remove();
cleanSelectAddressDelivery();
});
$(this).remove();
cleanSelectAddressDelivery();
if (!customizationId)
refreshOddRow();
});
var exist = false;
for (i=0;i<jsonData.summary.products.length;i++)
if (jsonData.summary.products[i].id_product == productId)
if (jsonData.summary.products[i].id_product == productId
&& jsonData.summary.products[i].id_product_attribute == productAttributeId
&& jsonData.summary.products[i].id_address_delivery == id_address_delivery)
exist = true;
// if all customization remove => delete product line
if (!exist)
$('#product_'+ productId+'_'+productAttributeId).fadeOut('slow', function() {
// if all customization removed => delete product line
if (!exist && customizationId)
$('#product_' + productId + '_' + productAttributeId + '_0_' + id_address_delivery).fadeOut('slow', function() {
$(this).remove();
refreshOddRow();
});
}
updateCartSummary(jsonData.summary);
@@ -322,6 +327,29 @@ function deleteProductFromSummary(id)
});
}
function refreshOddRow()
{
var odd_class = 'odd';
var even_class = 'even';
$.each($('.cart_item'), function(i, it)
{
if (i == 0) // First item
{
if ($(this).hasClass('even'))
{
odd_class = 'even';
even_class = 'odd';
}
$(this).addClass('first_item');
}
if(i % 2)
$(this).removeClass(odd_class).addClass(even_class);
else
$(this).removeClass(even_class).addClass(odd_class);
});
$('.cart_item:last-child, .customization:last-child').addClass('last_item');
}
function upQuantity(id, qty)
{
if (typeof(qty) == 'undefined' || !qty)