[-] FO : Fix bug #PSCFV-8364 block cart hidden or products are doubled

This commit is contained in:
gRoussac
2013-03-22 16:47:00 +01:00
parent ecf433b9b8
commit 8dcaa83eea
2 changed files with 25 additions and 22 deletions
+15 -14
View File
@@ -25,17 +25,11 @@
$(document).ready(function()
{
// If block cart isn't used, we don't bind the handle actions
if (window.ajaxCart !== undefined)
{
$('.cart_quantity_up').unbind('click').live('click', function(){ upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false; });
$('.cart_quantity_down').unbind('click').live('click', function(){ downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false; });
$('.cart_quantity_delete' ).unbind('click').live('click', function(){ deleteProductFromSummary($(this).attr('id')); return false; });
$('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: function(val) { updateQty(val, true, this.el); } });
}
$('.cart_address_delivery').live('change', function(){ changeAddressDelivery($(this)); });
$('.cart_quantity_up').unbind('click').live('click', function(){upQuantity($(this).attr('id').replace('cart_quantity_up_', '')); return false;});
$('.cart_quantity_down').unbind('click').live('click', function(){downQuantity($(this).attr('id').replace('cart_quantity_down_', '')); return false;});
$('.cart_quantity_delete' ).unbind('click').live('click', function(){deleteProductFromSummary($(this).attr('id')); return false;});
$('.cart_quantity_input').typeWatch({highlight: true, wait: 600, captureLength: 0, callback: function(val) { updateQty(val, true, this.el);}});
$('.cart_address_delivery').live('change', function(){changeAddressDelivery($(this));});
cleanSelectAddressDelivery();
});
@@ -149,9 +143,8 @@ function changeAddressDelivery(obj)
var id_address_delivery = 0;
var options = $('#select_address_delivery_'+id_product+'_'+id_product_attribute+'_'+old_id_address_delivery+' option');
$.each(options, function(i) {
if ($(options[i]).val() > 0 && $(options[i]).val() !== old_id_address_delivery
&& $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products
)
// Check the address is not already used for a similare products
if ($(options[i]).val() > 0 && $(options[i]).val() !== old_id_address_delivery && $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0)
{
id_address_delivery = $(options[i]).val();
return false;
@@ -233,6 +226,14 @@ function updateAddressId(id_product, id_product_attribute, old_id_address_delive
});
line.find('#select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + old_id_address_delivery).attr('id', 'select_address_delivery_' + id_product + '_' + id_product_attribute + '_' + id_address_delivery);
if (window.ajaxCart !== undefined)
{
$('#cart_block_list dd, #cart_block_list dt').each(function(){
if (typeof($(this).attr('id')) != 'undefined')
$(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_' + id_address_delivery));
});
}
}
function updateQty(val, cart, el)
+10 -8
View File
@@ -142,7 +142,13 @@ function updateAddressSelection()
// Update global var deliveryAddress
deliveryAddress = idAddress_delivery;
if (window.ajaxCart !== undefined)
{
$('#cart_block_list dd, #cart_block_list dt').each(function(){
if (typeof($(this).attr('id')) != 'undefined')
$(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_' + idAddress_delivery));
});
}
updateCarrierList(jsonData.carrier_data);
updatePaymentMethods(jsonData);
updateCartSummary(jsonData.summary);
@@ -385,18 +391,16 @@ function updateNewAccountToAddressBlock()
// update block user info
if (json.block_user_info !== '' && $('#header_user').length == 1)
{
$('#header_user').fadeOut('slow', function() {
$(this).attr('id', 'header_user_old').after(json.block_user_info).fadeIn('slow');
$('#header_user_old').remove();
var elt = $(json.block_user_info).find('#header_user_info').html();
$('#header_user_info').fadeOut('nortmal', function() {
$(this).html(elt).fadeIn();
});
}
$('#opc_new_account').fadeIn('fast', function() {
//After login, the products are automatically associated to an address
$.each(json.summary.products, function() {
updateAddressId(this.id_product, this.id_product_attribute, '0', this.id_address_delivery);
});
updateCartSummary(json.summary);
updateAddressesDisplay(true);
updateCarrierList(json.carrier_data);
@@ -610,10 +614,8 @@ $(function() {
// It's not a new customer
if ($('#opc_id_customer').val() !== '0')
{
if (!saveAddress('delivery'))
return false;
}
// update id_customer
$('#opc_id_customer').val(jsonData.id_customer);