Merge branch 'ticket-11784-QtyInShoppingCart' into develop

This commit is contained in:
Marion Muszynski 2016-11-28 12:02:59 +01:00
commit b8e6780110
2 changed files with 75 additions and 73 deletions

View File

@ -131,7 +131,7 @@ function deletProductFromSummary(id)
});
}
function updateLayerDelay()
function updateLayerDelay()
{
$('.delivery_delay_cart').each(function(index){
var line = $(this).next('tr').next('tr');
@ -257,48 +257,49 @@ function updateCartSummary(json)
var i;
var nbrProducts = 0;
if (typeof json == 'undefined')
return;
if (typeof json == 'undefined')
return;
for (i=0;i<json.products.length;i++)
{
key_for_blockcart = json.products[i].id_product+'_'+json.products[i].id_product_attribute;
if (json.products[i].id_product_attribute == 0)
key_for_blockcart = json.products[i].id_product;
$.each(json.products, function(key, json2) {
for (i=0;i<json2.products.length;i++)
{
key_for_blockcart = json2.products[i].id_product+'_'+json2.products[i].id_product_attribute;
if (json2.products[i].id_product_attribute == 0)
key_for_blockcart = json2.products[i].id_product;
$('#cart_block_product_'+key_for_blockcart+' span.quantity').html(json.products[i].cart_quantity);
$('#cart_block_product_'+key_for_blockcart+' span.quantity').html(json2.products[i].cart_quantity);
if (priceDisplayMethod != 0)
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].price, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
}
else
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].price_wt, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
}
if (priceDisplayMethod != 0)
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json2.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].price, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].total, currencyFormat, currencySign, currencyBlank));
}
else
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json2.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].price_wt, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
}
nbrProducts += parseInt(json.products[i].cart_quantity);
nbrProducts += parseInt(json2.products[i].cart_quantity);
if(json2.products[i].id_customization == null)
{
$('input[name=quantity_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')+']').val(json2.products[i].cart_quantity);
$('input[name=quantity_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')+'_hidden]').val(json2.products[i].cart_quantity);
}
else
{
$('#cart_quantity_custom_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(json2.products[i].cart_quantity);
}
if(json.products[i].id_customization == null)
{
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+']').val(json.products[i].cart_quantity);
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+'_hidden]').val(json.products[i].cart_quantity);
}
else
{
$('#cart_quantity_custom_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(json.products[i].cart_quantity);
}
// Show / hide quantity button if minimal quantity
if (parseInt(json.products[i].minimal_quantity) == parseInt(json.products[i].cart_quantity) && json.products[i].minimal_quantity != 1)
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',0.3);
else
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',1);
}
// Show / hide quantity button if minimal quantity
if (parseInt(json2.products[i].minimal_quantity) == parseInt(json2.products[i].cart_quantity) && json2.products[i].minimal_quantity != 1)
$('#cart_quantity_down_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')).fadeTo('slow',0.3);
else
$('#cart_quantity_down_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')).fadeTo('slow',1);
}
});
// Update discounts
if (json.discounts.length == 0)

View File

@ -247,46 +247,47 @@ function updateCartSummary(json)
if (typeof json == 'undefined')
return;
$.each(json.products, function(key, json2) {
for (i=0;i<json2.products.length;i++)
{
key_for_blockcart = json2.products[i].id_product+'_'+json2.products[i].id_product_attribute;
if (json2.products[i].id_product_attribute == 0)
key_for_blockcart = json2.products[i].id_product;
for (i=0;i<json.products.length;i++)
{
key_for_blockcart = json.products[i].id_product+'_'+json.products[i].id_product_attribute;
if (json.products[i].id_product_attribute == 0)
key_for_blockcart = json.products[i].id_product;
$('#cart_block_product_'+key_for_blockcart+' span.quantity').html(json2.products[i].cart_quantity);
$('#cart_block_product_'+key_for_blockcart+' span.quantity').html(json.products[i].cart_quantity);
if (priceDisplayMethod != 0)
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json2.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].price, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].total, currencyFormat, currencySign, currencyBlank));
}
else
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json2.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].price_wt, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(formatCurrency(json2.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
}
if (priceDisplayMethod != 0)
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].price, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total, currencyFormat, currencySign, currencyBlank));
}
else
{
$('#cart_block_product_'+key_for_blockcart+' span.price').html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
$('#product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].price_wt, currencyFormat, currencySign, currencyBlank));
$('#total_product_price_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(formatCurrency(json.products[i].total_wt, currencyFormat, currencySign, currencyBlank));
}
nbrProducts += parseInt(json2.products[i].cart_quantity);
nbrProducts += parseInt(json.products[i].cart_quantity);
if(json2.products[i].id_customization == null)
{
$('input[name=quantity_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')+']').val(json2.products[i].cart_quantity);
$('input[name=quantity_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')+'_hidden]').val(json2.products[i].cart_quantity);
}
else
{
$('#cart_quantity_custom_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute).html(json2.products[i].cart_quantity);
}
if(json.products[i].id_customization == null)
{
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+']').val(json.products[i].cart_quantity);
$('input[name=quantity_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')+'_hidden]').val(json.products[i].cart_quantity);
}
else
{
$('#cart_quantity_custom_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute).html(json.products[i].cart_quantity);
}
// Show / hide quantity button if minimal quantity
if (parseInt(json.products[i].minimal_quantity) == parseInt(json.products[i].cart_quantity) && json.products[i].minimal_quantity != 1)
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',0.3);
else
$('#cart_quantity_down_'+json.products[i].id_product+'_'+json.products[i].id_product_attribute+(json.products[i].id_customization != null ? '_'+json.products[i].id_customization : '')).fadeTo('slow',1);
}
// Show / hide quantity button if minimal quantity
if (parseInt(json2.products[i].minimal_quantity) == parseInt(json2.products[i].cart_quantity) && json2.products[i].minimal_quantity != 1)
$('#cart_quantity_down_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')).fadeTo('slow',0.3);
else
$('#cart_quantity_down_'+json2.products[i].id_product+'_'+json2.products[i].id_product_attribute+(json2.products[i].id_customization != null ? '_'+json2.products[i].id_customization : '')).fadeTo('slow',1);
}
});
// Update discounts
if (json.discounts.length == 0)