diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index ab9cd2070..0fead83ce 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -56,8 +56,8 @@ function cleanSelectAddressDelivery() $.each(options, function(i) { if ($(options[i]).val() > 0 - && ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length === 0 // Check the address is not already used for a similare products - || id_address_delivery === $(options[i]).val() + && ($('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products + || id_address_delivery == $(options[i]).val() ) ) address_count++; @@ -66,7 +66,7 @@ function cleanSelectAddressDelivery() // Need at least two address to allow skipping products to multiple address if (address_count < 2) $($(item).find('option[value=-2]')).remove(); - else if($($(item).find('option[value=-2]')).length === 0) + else if($($(item).find('option[value=-2]')).length == 0) $(item).append($('')); }); } @@ -79,8 +79,8 @@ function changeAddressDelivery(obj) var id_product_attribute = ids[4]; var old_id_address_delivery = ids[5]; var new_id_address_delivery = obj.val(); - - if (new_id_address_delivery === old_id_address_delivery) + + if (new_id_address_delivery == old_id_address_delivery) return; if (new_id_address_delivery > 0) // Change the delivery address @@ -92,7 +92,7 @@ function changeAddressDelivery(obj) async: true, cache: false, dataType: 'json', - data: 'controller=cart&ajax=true&changeAddressDelivery&summary&id_product='+id_product + data: 'controller=cart&ajax=true&changeAddressDelivery=1&summary=1&id_product='+id_product +'&id_product_attribute='+id_product_attribute +'&old_id_address_delivery='+old_id_address_delivery +'&new_id_address_delivery='+new_id_address_delivery @@ -100,7 +100,7 @@ function changeAddressDelivery(obj) +'&allow_refresh=1', success: function(jsonData) { - if (typeof(jsonData.hasErrors) !== 'undefined' && jsonData.hasErrors) + if (typeof(jsonData.hasErrors) != 'undefined' && jsonData.hasErrors) { alert(jsonData.error); // Reset the old address @@ -126,7 +126,7 @@ function changeAddressDelivery(obj) $('.product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove(); } - if (window.ajaxCart !== undefined) + if (window.ajaxCart != undefined) ajaxCart.refresh(); updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery); cleanSelectAddressDelivery(); @@ -150,7 +150,7 @@ function changeAddressDelivery(obj) 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 + && $('#product_' + id_product + '_' + id_product_attribute + '_0_' + $(options[i]).val()).length == 0 // Check the address is not already used for a similare products ) { id_address_delivery = $(options[i]).val(); @@ -208,7 +208,7 @@ function changeAddressDelivery(obj) function updateAddressId(id_product, id_product_attribute, old_id_address_delivery, id_address_delivery, line) { - if (typeof(line) === 'undefined') + if (typeof(line) == 'undefined') line = $('#product_' + id_product+'_' + id_product_attribute + '_0_' + old_id_address_delivery); line.attr('id', 'product_' + id_product+'_' + id_product_attribute + '_0_' + id_address_delivery); @@ -230,7 +230,7 @@ function updateQty(val, cart, el) { var prefix = ""; - if (typeof(cart) === 'undefined' || cart) + if (typeof(cart) == 'undefined' || cart) prefix = '#order-detail-content '; else prefix = '#fancybox-content '; @@ -238,7 +238,7 @@ function updateQty(val, cart, el) var id = $(el).attr('name'); var exp = new RegExp("^[0-9]+$"); - if (exp.test(val) === true) + if (exp.test(val) == true) { var hidden = $(prefix+'input[name='+ id +'_hidden]').val(); var input = $(prefix+'input[name='+ id +']').val(); @@ -300,9 +300,9 @@ function deleteProductFromSummary(id) { if (jsonData.refresh) location.reload(); - if (parseInt(jsonData.summary.products.length) === 0) + if (parseInt(jsonData.summary.products.length) == 0) { - if (typeof(orderProcess) === 'undefined' || orderProcess !== 'order-opc') + if (typeof(orderProcess) == 'undefined' || orderProcess !== 'order-opc') document.location.href = document.location.href; // redirection else { @@ -329,9 +329,9 @@ function deleteProductFromSummary(id) var exist = false; for (i=0;i delete product line @@ -363,7 +363,7 @@ function refreshOddRow() var even_class = 'even'; $.each($('.cart_item'), function(i, it) { - if (i === 0) // First item + if (i == 0) // First item { if ($(this).hasClass('even')) { @@ -382,7 +382,7 @@ function refreshOddRow() function upQuantity(id, qty) { - if (typeof(qty) === 'undefined' || !qty) + if (typeof(qty) == 'undefined' || !qty) qty = 1; var customizationId = 0; var productId = 0; @@ -453,7 +453,7 @@ function downQuantity(id, qty) { var val = $('input[name=quantity_'+id+']').val(); var newVal = val; - if(typeof(qty) === 'undefined' || !qty) + if(typeof(qty) == 'undefined' || !qty) { qty = 1; newVal = val - 1; @@ -519,7 +519,7 @@ function downQuantity(id, qty) updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART); updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA); - if (newVal === 0) + if (newVal == 0) $('#product_'+id).hide(); if (typeof(getCarrierListAndUpdate) !== 'undefined') @@ -547,7 +547,7 @@ function updateCartSummary(json) var i; var nbrProducts = 0; - if (typeof json === 'undefined') + if (typeof json == 'undefined') return; $('div.error').fadeOut(); @@ -570,7 +570,7 @@ function updateCartSummary(json) { for (i=0;i 0) + if ($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val()) + params += 'id_state='+encodeURIComponent($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; + params += 'other='+encodeURIComponent($('#other'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; + params += 'phone='+encodeURIComponent($('#phone'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; + params += 'phone_mobile='+encodeURIComponent($('#phone_mobile'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; + params += 'alias='+encodeURIComponent($('#alias'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; + if (type == 'delivery' && $('#opc_id_address_delivery').val() != undefined && parseInt($('#opc_id_address_delivery').val()) > 0) params += 'opc_id_address_delivery='+encodeURIComponent($('#opc_id_address_delivery').val())+'&'; - if (type === 'invoice' && $('#opc_id_address_invoice').val() != undefined && parseInt($('#opc_id_address_invoice').val()) > 0) + if (type == 'invoice' && $('#opc_id_address_invoice').val() != undefined && parseInt($('#opc_id_address_invoice').val()) > 0) params += 'opc_id_address_invoice='+encodeURIComponent($('#opc_id_address_invoice').val())+'&'; // Clean the last & params = params.substr(0, params.length-1); @@ -377,13 +377,13 @@ function updateNewAccountToAddressBlock() success: function(json) { isLogged = 1; - if (json.no_address === 1) + if (json.no_address == 1) document.location.href = addressUrl; $('#opc_new_account').fadeOut('fast', function() { $('#opc_new_account').html(json.order_opc_adress); // update block user info - if (json.block_user_info !== '' && $('#header_user').length === 1) + 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'); @@ -402,7 +402,7 @@ function updateNewAccountToAddressBlock() updateCarrierList(json.carrier_data); updateCarrierSelectionAndGift(); updatePaymentMethods(json); - if ($('#gift-price').length === 1) + if ($('#gift-price').length == 1) $('#gift-price').html(json.gift_price); $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow'); }); @@ -524,7 +524,7 @@ $(function() { var callingFile = ''; var params = ''; - if (parseInt($('#opc_id_customer').val()) === 0) + if (parseInt($('#opc_id_customer').val()) == 0) { callingFile = authenticationUrl; params = 'submitAccount=true&'; @@ -596,7 +596,7 @@ $(function() { }); } - isGuest = parseInt($('#is_new_customer').val()) === 1 ? 0 : 1; + isGuest = parseInt($('#is_new_customer').val()) == 1 ? 0 : 1; // update addresses id if(jsonData.id_address_delivery !== undefined && jsonData.id_address_delivery > 0) $('#opc_id_address_delivery').val(jsonData.id_address_delivery); @@ -668,7 +668,7 @@ function bindCheckbox() if ($('#invoice_address:checked').length > 0) { $('#opc_invoice_address').slideDown('slow'); - if ($('#company_invoice').val() === '') + if ($('#company_invoice').val() == '') $('#vat_number_block_invoice').hide(); updateState('invoice'); updateNeedIDNumber('invoice');