diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index 8847fb46d..a77ad7182 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -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) diff --git a/themes/default/js/order-opc.js b/themes/default/js/order-opc.js index 900cdc377..53d1e8f46 100644 --- a/themes/default/js/order-opc.js +++ b/themes/default/js/order-opc.js @@ -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);