This commit is contained in:
PLESK5 2017-05-05 10:51:48 +02:00
parent cce0dd2d56
commit 0f7fb86c84
2 changed files with 47 additions and 34 deletions

View File

@ -1281,6 +1281,11 @@ var PS_MRObject = (function($, undifened) {
return true;
});
var mrChecked = $('#delivery_option_3954_1').prop('checked');
if(mrChecked) {
$('#delivery_option_3954_1').trigger('click');
}
if (typeof(PS_MR_SELECTED_TAB ) != 'undefined')
$('#MR_' + PS_MR_SELECTED_TAB + '_block').fadeIn('fast');

View File

@ -693,8 +693,12 @@ function downQuantity(id, qty)
}
}
function updateCartSummary(json)
{
function updateCartSummary(json, test_discount)
{
if (test_discount == 'undefined') {
test_discount = true;
}
var i;
var nbrProducts = 0;
var product_list = new Array();
@ -767,43 +771,47 @@ function updateCartSummary(json)
nbrProducts += parseInt(product_list[i].quantity);
}
// Update discounts
if (json.discounts.length == 0)
{
$('.cart_discount').each(function(){$(this).remove();});
$('.cart_total_voucher').remove();
}
else
{
if ($('.cart_discount').length == 0)
location.reload();
if (priceDisplayMethod !== 0)
$('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
if (test_discount) {
// Update discounts
if (json.discounts.length == 0)
{
$('.cart_discount').each(function(){$(this).remove();});
$('.cart_total_voucher').remove();
}
else
$('#total_discount').html('-' + formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank));
{
if ($('.cart_discount').length == 0)
location.reload();
$('.cart_discount').each(function(){
var idElmt = $(this).attr('id').replace('cart_discount_','');
var toDelete = true;
if (priceDisplayMethod !== 0)
$('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
else
$('#total_discount').html('-' + formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank));
for (i=0;i<json.discounts.length;i++)
if (json.discounts[i].id_discount == idElmt)
{
if (json.discounts[i].value_real !== '!')
$('.cart_discount').each(function(){
var idElmt = $(this).attr('id').replace('cart_discount_','');
var toDelete = true;
for (i=0;i<json.discounts.length;i++)
if (json.discounts[i].id_discount == idElmt)
{
if (priceDisplayMethod !== 0)
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_tax_exc * -1, currencyFormat, currencySign, currencyBlank));
else
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank));
if (json.discounts[i].value_real !== '!')
{
if (priceDisplayMethod !== 0)
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_tax_exc * -1, currencyFormat, currencySign, currencyBlank));
else
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank));
}
toDelete = false;
}
toDelete = false;
}
if (toDelete)
$('#cart_discount_' + idElmt + ', #cart_total_voucher').fadeTo('fast', 0, function(){ $(this).remove(); });
});
if (toDelete)
$('#cart_discount_' + idElmt + ', #cart_total_voucher').fadeTo('fast', 0, function(){ $(this).remove(); });
});
}
}
// Block cart
$('#cart_block_shipping_cost').show();
$('#cart_block_shipping_cost').next().show();
@ -919,8 +927,8 @@ function updateCartSummary(json)
$('#modeDeLivraison').show();
}
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
// if (window.ajaxCart !== undefined)
// ajaxCart.refresh();
}
function updateCustomizedDatas(json)
@ -1033,7 +1041,7 @@ function updateExtraCarrier(id_delivery_option, id_address)
+'&allow_refresh=1',
success: function(jsonData)
{
updateCartSummary(jsonData['summary']);
updateCartSummary(jsonData['summary'], false);
$('#HOOK_EXTRACARRIER_'+id_address).html(jsonData['content']);
},
error: function(jsonData)