$( function() { $("#completa-ordine").click(function() { if ( parseInt( $('#ordine_acquistabile').val() ) > 0 ) { if( fCheckObbligatori() ) fSaveData(); } else swal( "ATENCIÓN!", "El pedido no está disponible.", "error" ); }); $('#txtEmail').change(function() { $('.loader-txtEmail').removeClass('hide'); $('#lbltxtEmail-login').addClass('hide'); $('#lbltxtEmail, #lbltxtEmail-login').html(''); $( ".fg-txtEmail" ).removeClass( "has-error" ); if ( $(this).val() != '' ) { var data; $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/checkContatto.php", data: "action=checkEmailCarrello&pstrEmail=" + $('#txtEmail').val(), success: function(data) { if ( data.email_check == 0 ) { // Email non corretta if ( data.email_errore == 2 ) { // ERRORE : email NON esiste $('#lbltxtEmail').html( fHTMLErrore( "El correo electrónico no existe.." ) ); $( ".fg-txtEmail" ).addClass( "has-error" ); } else if ( data.email_errore == 1 ) { // ERRORE : email NON corretta $('#lbltxtEmail').html( fHTMLErrore( "El correo electrónico no es correcta." ) ); $( ".fg-txtEmail" ).addClass( "has-error" ); } } else if ( $('#id_cliente').val() == '' ) { // Email corretta if ( data.email_exists == 1 ) { // AVVISO : email già in archivio $('#lbltxtEmail-login').removeClass('hide').html( 'Hello ' + data.nome + ',
your email is already registered on the site.
You can login if you want, or re-enter the data and complete the order.' ); $('.row-scelta-registrazione-box').addClass('hide'); $('#email_gia_registrata').val( 1 ); } else { $('.row-scelta-registrazione-box').removeClass('hide'); $('#email_gia_registrata').val( 0 ); } } } }); /* ajax */ } else { // ERRORE : email obbligatoria $('#lbltxtEmail').html( fHTMLErrore( "Campo obligatorio" ) ); $( ".fg-txtEmail" ).addClass( "has-error" ); } $('.loader-txtEmail').addClass('hide'); }); $('input[name=pagamento]').change(function() { $('#totale_ordine_loader').removeClass('hide'); $('.scegli-pagamento-radio label > span').removeClass('active'); $('.pagamento_descrizione').addClass('hide'); var pagid = $(this).val(); if ( $(this).prop('checked') ) { $( '#pagamento_span_' + pagid ).addClass('active'); $( '.pagamento_descrizione_' + pagid ).removeClass('hide'); } fAggiornaTotaleOrdine(); $('#totale_ordine_loader').addClass('hide'); }); // sp_nazione $('#cmbSpNazione').change(function() { if ( $(this).val() == 'IT' ) { $('#label_ricarica_postepay').removeClass('hide'); $('#col-sp-citta').removeClass('col-md-8').addClass('col-md-4'); $('#col-sp-provincia').removeClass('hide'); //$('#via_ig').addClass('input-group'); } else { $('#label_ricarica_postepay').addClass('hide'); if ( $("input[name=pagamento]:checked").val() == 'ricarica_postepay' ) { $('.scegli-pagamento-radio label > span').removeClass('active'); $('.pagamento_descrizione').addClass('hide'); $('#pagamento_paypal').prop('checked', true); $( '#pagamento_span_paypal' ).addClass('active'); $( '.pagamento_descrizione_paypal' ).removeClass('hide'); } $('#col-sp-provincia').addClass('hide'); $('#col-sp-citta').removeClass('col-md-4').addClass('col-md-8'); //$('#via_ig').removeClass('input-group'); } fAggiornaTotaleOrdine(); }); // nazione $('#cmbNazione').change(function() { if ( $(this).val() == 'IT' ) { $('#label_ricarica_postepay').removeClass('hide'); $('#col-citta').removeClass('col-md-8').addClass('col-md-4'); $('#col-provincia').removeClass('hide'); //$('#via_ig').addClass('input-group'); } else { $('#label_ricarica_postepay').addClass('hide'); if ( $("input[name=pagamento]:checked").val() == 'ricarica_postepay' ) { $('.scegli-pagamento-radio label > span').removeClass('active'); $('.pagamento_descrizione').addClass('hide'); $('#pagamento_paypal').prop('checked', true); $( '#pagamento_span_paypal' ).addClass('active'); $( '.pagamento_descrizione_paypal' ).removeClass('hide'); } $('#col-provincia').addClass('hide'); $('#col-citta').removeClass('col-md-4').addClass('col-md-8'); //$('#via_ig').removeClass('input-group'); } fAggiornaTotaleOrdine(); }); // nazione $('#cmbFattNazione').change(function() { if ( $(this).val() == 'IT' ) { $('#col-fatt-citta').removeClass('col-md-8').addClass('col-md-4'); $('#col-fatt-provincia').removeClass('hide'); } else { $('#col-fatt-provincia').addClass('hide'); $('#col-fatt-citta').removeClass('col-md-4').addClass('col-md-8'); } fAggiornaTotaleOrdine(); }); /*$('input[name=radioAssicurata]').change(function() { fAggiornaTotaleOrdine(); });*/ $('#verifica_codice_sconto').click(function() { $('#row-sconto-carrello').addClass('hide'); $('#sconto_carrello_descrizione, #sconto_carrello_label').html( '' ); $('#sconto_carrello').val( 0 ); $('#codice_sconto_carrello').val( '' ); $('.fg-txtCodiceScontoInput').removeClass('has-error'); if ( $.trim( $('#txtCodiceScontoInput').val() ) == '' ) { $('.fg-txtCodiceScontoInput').addClass('has-error'); $('#txtCodiceScontoInput').focus(); } else { $('.panel-hai-un-codice').addClass('hide'); $('.panel-hai-un-codice-loader').removeClass('hide'); var data; var blnVerifica = false; var strLabelTop = ""; var strLabel = ""; var strLabelType = ""; $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCodiceSconto.php", data: "action=setCodiceSconto&id_cliente=" + $("#id_cliente").val() + "&codice_sconto=" + $('#txtCodiceScontoInput').val() + "&lang_current=" + $('#lang_current').val(), success: function(data) { $('#hai-un-codice-loader').addClass('hide'); if ( data.status == 'ok' ) { if ( data.verifica > 0 ) { blnVerifica = true; $('#sconto_carrello_descrizione').html( data.sconto_descrizione ); $('#sconto_carrello_label').html( data.sconto_valore_label ); $('#sconto_carrello').val( data.sconto_valore ); $('#codice_sconto_carrello').val( data.codice ); $('#row-sconto-carrello').removeClass('hide'); $('#codice_success_label').html( data.sconto_success_label ); strLabelTop = "Ok"; strLabel = "El código de descuento ha sido ingresado correctamente."; strLabelType = "success"; } else { strLabelTop = data.label_top; strLabel = data.label; strLabelType = data.label_type; } } else swal("Oops!", "No se pudo realizar la operación.", "error"); }, error: function(data) { swal("Oops!", "Procedimiento no completado.", "error"); } }); fAggiornaTotaleOrdine(); $('.panel-hai-un-codice-loader').addClass('hide'); if ( blnVerifica ) $('.panel-hai-un-codice-success').removeClass('hide'); else $('.panel-hai-un-codice').removeClass('hide'); if ( strLabelTop != "" ) swal( strLabelTop, strLabel,strLabelType ); } }); $('#rimuovi_codice_sconto').click(function() { $('.panel-hai-un-codice-success').addClass('hide'); $('.panel-hai-un-codice-loader').removeClass('hide'); $('#row-sconto-carrello').addClass('hide'); $('#sconto_carrello_descrizione, #sconto_carrello_label').html( '' ); $('#sconto_carrello').val( 0 ); $('#codice_sconto_carrello').val( '' ); $('#txtCodiceScontoInput').val( '' ); fAggiornaTotaleOrdine(); $('.panel-hai-un-codice-loader').addClass('hide'); $('.panel-hai-un-codice').removeClass('hide'); swal( "Ok", "Lo sconto è stato rimosso.", "success" ); }); // Mostra domanda $('.showdomanda').click(function() { $( '#box_txtDomanda' ).addClass('hide'); $( '#boxlista_txtDomanda' ).removeClass('hide'); }); // Mostra lista domande $('.listadomande').change(function() { $( '#txtDomanda' ).val( $(this).val() ); $( '#boxlista_txtDomanda' ).addClass('hide'); $( '#lbltxtDomanda' ).html(''); $( '#box_txtDomanda' ).removeClass('hide'); $( '#txtDomanda' ).focus(); }); }); function fAggiornaTotaleOrdine() { $('#totale_ordine_loader').removeClass('hide'); var data; var strID_Pagamento = $("input[name=pagamento]:checked").val(); var strNazione = $("#cmbSpNazione").val(); if ( strNazione == '' ) strNazione = 'IT'; $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCarrello.php", data: "action=setTotaleCarrello" + "&id_cliente=" + $("#id_cliente").val() + "&provincia=" + $("#cmbSpProvincia").val() + "&nazione=" + strNazione + "&id_pagamento=" + strID_Pagamento + "&sconto=" + $("#sconto_carrello").val() + "&totale_peso=" + $("#totale_peso").val() + "&assicurata_con=" + ( $("#radioAssicurata_assicurata").prop('checked') ? 1 : 0 ) + "&pstrLangCurrent=" + $("#lang_current").val() + "&totale_carrello_prodotti=" + $("#totale_carrello_prodotti").val() + "&totale_carrello_shop=" + $("#totale_carrello_shop").val(), success: function(data) { if ( data.status == 'ok' ) { $('#costo_spedizione').val( data.spedizione_totale ); $('#costo_spedizione_standard').val( data.spedizione_costo_db ); $('#costo_spedizione_assicurata').val( data.assicurazione_db ); $('.crl_spedizione_label').html( data.spedizione_label ); $('.crl_spedizione_totale_label').html( data.spedizione_totale_label ); if ( parseInt( data.ordine_acquistabile ) > 0 ) { if ( data.spedizione_costo_db > 0 ) $('.crl_spedizione_standard').html( data.spedizione_costo ); else $('.crl_spedizione_standard').html( '  GRATIS' ); if ( data.spedizione_totale > 0 ) $('.crl_spedizione_costo_label').html( data.spedizione_totale_format ); else $('.crl_spedizione_costo_label').html( 'GRATIS' ); $('.crl_costo_assicurata').html( data.assicurazione ); $('.spedizione_nondisponibile_provincia').addClass('hide'); $('.spedizione_nondisponibile').addClass('hide'); $('.assicurata_box').removeClass('hide'); } else if ( $("#cmbNazione").val() == 'IT' && $.trim( $("#cmbProvincia").val() ) == '' ) { $('.crl_spedizione_costo_label').html( 'elige la provincia' ); $('.assicurata_box').addClass('hide'); $('.spedizione_nondisponibile').addClass('hide'); $('.spedizione_nondisponibile_provincia').removeClass('hide'); } else { $('.crl_spedizione_costo_label').html( 'no disponible' ); $('.spedizione_nondisponibile_provincia').addClass('hide'); $('.assicurata_box').addClass('hide'); $('.spedizione_nondisponibile').removeClass('hide'); } $('#crl_totale_label').html( data.totale_ordine ); $('#ordine_acquistabile').val( parseInt( data.ordine_acquistabile ) ); } else swal("Oops!", "No se pudo realizar la operación.", "error"); }, error: function(data) { swal("Oops!", "Procedimiento no completado.", "error"); } }); if ( strID_Pagamento == 'paypal' || strID_Pagamento == 'carta' || strID_Pagamento == 'postepay' ) $('#row-paypal-commissioni').removeClass('hide'); else $('#row-paypal-commissioni').addClass('hide'); $('#totale_ordine_loader').addClass('hide'); } function fSaveData() { $('submit').focus(); $('#submitBut').addClass('hide'); $('#submitLoad').removeClass('hide'); var data; var strDestination = ''; var strID_Ordine = ''; var strPagamento = ''; var blnSaved = false; $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/sendOrder.php", data: $("#frmCompletaOrdine").serialize(), success: function(data) { strPagamento = data.pagamento; if ( data.status == 'obbligatori' ) $('#completaErrore').removeClass('hide'); else $('#completaErrore').addClass('hide'); if ( data.status == 'ok' ) { blnSaved = true; strID_Ordine = data.id_ordine; strDestination = data.destination; } else swal("Oops!", "Algo salió mal.", "error"); }, error: function(data) { swal("Oops!", "Algo salió mal.", "error"); } }); if ( strID_Ordine != '' && strDestination != '' ) { location.href = strDestination; } else { $('#submitLoad').addClass('hide'); $('#submitBut').removeClass('hide'); } } // Controllo campi obbligatori function fCheckObbligatori() { var blnReturn = true; var strAlert = ""; $('submit').focus(); $('#submitBut').addClass('hide'); $('#submitLoad').removeClass('hide'); $( ".has-error" ).removeClass( "has-error" ); $( ".lbl" ).html(""); var strID_Contatto = ( $('#id_cliente').length ? $('#id_cliente').val() : '' ); // Controllo email if ( $("#txtEmail").val() != '' ) { $('#loader-email').removeClass('hide'); $('#lbltxtEmail').html( '' ); var intErrore = ''; $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/checkEmail.php", data: "action=checkEmail&pstrEmail=" + $("#txtEmail").val(), success: function(data) { intErrore = data.errore; if ( intErrore == 1 ) { // ERRORE : email NON corretta blnReturn = false; $('#lbltxtEmail').html( fHTMLErrore( "La dirección es incorrecta." ) ); $( ".fg-txtEmail" ).addClass( "has-error" ); strAlert = "El correo electrónico no es correcta."; } else if ( intErrore == 2 ) { // ERRORE : email NON esiste blnReturn = false; $('#lbltxtEmail').html( fHTMLErrore( "La dirección no existe" ) ); $( ".fg-txtEmail" ).addClass( "has-error" ); strAlert = "El correo electrónico no existe.."; } if ( data.status == 'errore' ) blnSaved = false; else if ( data.status == 'ok' ) blnSaved = true; else swal("Ops...", "Verificación fallida", "error"); }, error: function(data) { swal("Ops...", "Procedimiento no completado.", "error"); } }); } if ( blnReturn ) { $('.required').each(function() { if ( $.trim( $(this).val() ) == "" ) { blnReturn = false; $( "#lbl" + $(this).attr("name") ).html( fHTMLErrore( "Campo obligatorio" ) ); $( ".fg-" + $(this).attr("name") ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci i campi obbligatori "; /* + $(this).attr("name") + $( "#lbl" + $(this).attr("name") ).attr("title");*/ } else $( "#lbl" + $(this).attr("name") ).html(""); }); } if ( blnReturn && $('#fattura_si').prop('checked') ) { // Controllo ragione sociale if ( $.trim( $('#txtFattNominativo').val() ) == '' ) { blnReturn = false; $('#lbltxtFattNominativo').html( fHTMLErrore( "" ) ); $( ".fg-txtFattNominativo" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la ragione sociale per la fattura"; } else $('#lbltxtFattNominativo').html(""); // Controllo codice fiscale o partita IVA if ( $.trim( $('#txtCodiceFiscale').val() ) == '' && $.trim( $('#txtPartitaIva').val() ) == '' ) { blnReturn = false; $('#lbltxtCodiceFiscale, #lbltxtPartitaIva').html( fHTMLErrore( "" ) ); $( ".fg-txtCodiceFiscale, .fg-txtPartitaIva" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci il codice fiscale o la partita IVA per la fattura"; } else $('#lbltxtCodiceFiscale, #lbltxtPartitaIva').html(""); // Controllo indirizzo if ( $.trim( $('#txtFattIndirizzo').val() ) == '' ) { blnReturn = false; $('#lbltxtFattIndirizzo').html( fHTMLErrore( "" ) ); $( ".fg-txtFattIndirizzo" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci l'indirizzo per la fattura"; } else $('#lbltxtFattIndirizzo').html(""); // Controllo cap if ( $.trim( $('#txtFattCap').val() ) == '' ) { blnReturn = false; $('#lbltxtFattCap').html( fHTMLErrore( "" ) ); $( ".fg-txtFattCap" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci il CAP per la fattura"; } else $('#lbltxtFattCap').html(""); // Controllo citta if ( $.trim( $('#txtFattCitta').val() ) == '' ) { blnReturn = false; $('#lbltxtFattCitta').html( fHTMLErrore( "" ) ); $( ".fg-txtFattCitta" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la città per la fattura"; } else $('#lbltxtFattCitta').html(""); // Controllo nazione if ( $.trim( $('#cmbFattNazione').val() ) == '' ) { blnReturn = false; $('#lblcmbFattNazione').html( fHTMLErrore( "" ) ); $( ".fg-cmbFattNazione" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la nazione per la fattura"; } else $('#lblcmbFattNazione').html(""); // Controllo provincia if ( $('#cmbFattNazione').val() == 'IT' && $.trim( $('#cmbFattProvincia').val() ) == '' ) { blnReturn = false; $('#lblcmbFattProvincia').html( fHTMLErrore( "" ) ); $( ".fg-cmbFattProvincia" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la provincia per la fattura"; } else $('#lblcmbFattProvincia').html(""); } if ( blnReturn && parseInt($('#has_shop').val()) > 0 ) { // Controllo indirizzo if ( $.trim( $('#txtSpIndirizzo').val() ) == '' ) { blnReturn = false; $('#lbltxtSpIndirizzo').html( fHTMLErrore( "" ) ); $( ".fg-txtSpIndirizzo" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci l'indirizzo per la spedizione"; } else $('#lbltxtSpIndirizzo').html(""); // Controllo civico if ( $.trim( $('#txtCivico').val() ) == '' ) { blnReturn = false; $('#lbltxtCivico').html( fHTMLErrore( "" ) ); $( ".fg-txtCivico" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci il numero civico per la spedizione"; } else $('#lbltxtCivico').html(""); // Controllo cap if ( $.trim( $('#txtSpCap').val() ) == '' ) { blnReturn = false; $('#lbltxtSpCap').html( fHTMLErrore( "" ) ); $( ".fg-txtSpCap" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci il CAP per la spedizione"; } else $('#lbltxtSpCap').html(""); // Controllo citta if ( $.trim( $('#txtSpCitta').val() ) == '' ) { blnReturn = false; $('#lbltxtSpCitta').html( fHTMLErrore( "" ) ); $( ".fg-txtSpCitta" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la città per la spedizione"; } else $('#lbltxtSpCitta').html(""); // Controllo nazione if ( $.trim( $('#cmbSpNazione').val() ) == '' ) { blnReturn = false; $('#lblcmbSpNazione').html( fHTMLErrore( "" ) ); $( ".fg-cmbSpNazione" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la nazione per la spedizione"; } else $('#lblcmbSpNazione').html(""); // Controllo provincia if ( $('#cmbSpNazione').val() == 'IT' && $.trim( $('#cmbSpProvincia').val() ) == '' ) { blnReturn = false; $('#lblcmbSpProvincia').html( fHTMLErrore( "" ) ); $( ".fg-cmbSpProvincia" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Inserisci la provincia per la spedizione"; } else $('#lblcmbSpProvincia').html(""); } if ( blnReturn ) { if ( ! parseInt( $('#email_gia_registrata').val() ) ) { // Controllo password if ( $.trim( $('#txtPassword').val() ) == '' ) { blnReturn = false; $("#lbltxtPassword").html( fHTMLErrore( "Campo obligatorio" ) ); $(".fg-txtPassword").addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Ingrese su contraseña"; } else $("#lbltxtPassword").html(""); if ( $.trim( $('#txtConfermaPassword').val() ) == '' ) { blnReturn = false; $("#lbltxtConfermaPassword").html( fHTMLErrore( "Campo obligatorio" ) ); $(".fg-txtConfermaPassword").addClass( "has-error" ); if ( strAlert == "" ) strAlert = "Ingrese la confirmación de contraseña"; } else $("#lbltxtConfermaPassword").html(""); if ( $('#txtPassword').val() != '' || $('#txtConfermaPassword').val() != '' ) { if ( $('#txtPassword').val() != $('#txtConfermaPassword').val() ) { blnReturn = false; $('#lbltxtConfermaPassword').html( fHTMLErrore( "La contraseña no es la misma." ) ); $( ".fg-txtConfermaPassword" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "La contraseña no es la misma."; } else $('#lbltxtConfermaPassword').html(""); } if ( $.trim( $('#txtDomanda').val() ) == '' ) { $( '#boxlista_txtDomanda' ).addClass('hide'); $( '#box_txtDomanda' ).removeClass('hide'); blnReturn = false; $('#lbltxtDomanda').html( fHTMLErrore( "Campo obligatorio" ) ); $( ".fg-txtDomanda" ).addClass( "has-error" ); } else $('#lbltxtRisposta').html(""); if ( $.trim( $('#txtRisposta').val() ) == '' ) { blnReturn = false; $('#lbltxtRisposta').html( fHTMLErrore( "Campo obligatorio" ) ); $( ".fg-txtRisposta" ).addClass( "has-error" ); } else $('#lbltxtRisposta').html(""); } } if ( blnReturn ) { if ( parseFloat($('#totale_paga_struttura').val()) > 0 ) { if ( ! $('#cardToken').length || $.trim( $('#cardToken').text() ) == '' ) { blnReturn = false; $('#lbltxtAggiungiCarta').html( '
È necessario aggiungere la carta per confermare la prenotazione
' ); if ( strAlert == "" ) strAlert = "È necessario aggiungere la carta per confermare la prenotazione"; } } } if ( blnReturn ) { // Controllo condizioni if( ! $('#condizioni').prop('checked') ) { blnReturn = false; $('#lblcondizioni').html( fHTMLErrore( "Aceptación obligatoria." ) ); $( ".fg-condizioni" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "La conferma della lettura delle condizioni è obbligatoria"; } else $('#lblcondizioni').html(""); } if ( blnReturn ) { // Controllo regolamento if( ! $('#regolamento').prop('checked') ) { blnReturn = false; $('#lblregolamento').html( fHTMLErrore( "Aceptación obligatoria." ) ); $( ".fg-regolamento" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "La aceptación de los Términos y Condiciones es obligatoria."; } else $('#lblregolamento').html(""); } if ( blnReturn ) { // Controllo privacy if( ! $('#privacy').prop('checked') ) { blnReturn = false; $('#lblprivacy').html( fHTMLErrore( "Aceptación obligatoria." ) ); $( ".fg-privacy" ).addClass( "has-error" ); if ( strAlert == "" ) strAlert = "La aceptación de la política de privacidad es obligatoria."; } else $('#lblprivacy').html(""); } $('#submitLoad').addClass('hide'); $('#submitBut').removeClass('hide'); if ( ! blnReturn ) { $('#completaErrore').removeClass('hide'); if ( strAlert != "" ) swal("ATENCIÓN!", strAlert, "error"); } else $('#completaErrore').addClass('hide'); return blnReturn; } function fHTMLErrore( pstr ) { return '' + pstr + ''; } // Aggiorna quantita function fAggiornaQuantita( pstrKey, pintID_Riga ) { fLoading( 1 ); var pintQuantita = $('#quantita_'+pintID_Riga).val(); $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCarrello.php", data: "action=aggiornaQuantita&pstrKey=" + pstrKey + "&pintID_Riga=" + pintID_Riga + "&pintQuantita=" + pintQuantita, success: function(data) { if ( data.status == 'ok' ) { location.href = 'https://www.metour.it/es/compras/' + ( data.max == 'exceed' ? '?max=exceed' : '' ); } else swal("Oops!", "No se pudo realizar la operación.", "error"); }, error: function(data) { swal("Oops!", "Procedimiento no completado.", "error"); } }); } // Rimuovi prodotto function fDelProd( pstrKey, pintID_Riga ) { swal({ title: "ATENCIÓN!", text: "¿Quieres eliminar este producto del carrito?", type: "warning", showCancelButton: true, cancelButtonText: "No, cancelar", confirmButtonText: "Sí, borrar!", closeOnConfirm: true }, function() { fLoading( 1 ); $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCarrello.php", data: "action=rimuoviProdotto&pstrKey=" + pstrKey + "&pintID_Riga=" + pintID_Riga, success: function(data) { if ( data.status == 'ok' ) { location.href = 'https://www.metour.it/es/compras/'; } else swal("Oops!", "No se pudo realizar la operación.", "error"); }, error: function(data) { swal("Oops!", "Procedimiento no completado.", "error"); } }); }); } // Svuota carrello function fSvuotaCarrello( pstrKey ) { swal({ title: "ATENCIÓN!", text: "¿Quieres eliminar todos los productos del carrito?", type: "warning", showCancelButton: true, cancelButtonText: "No, cancelar", confirmButtonText: "Sí, borrar!", closeOnConfirm: true }, function() { fLoading( 1 ); $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCarrello.php", data: "action=svuotaCarrello&pstrKey=" + pstrKey, success: function(data) { if ( data.status == 'ok' ) { location.href = 'https://www.metour.it/es/compras/'; } else swal("Oops!", "No se pudo realizar la operación.", "error"); }, error: function(data) { swal("Oops!", "Procedimiento no completado.", "error"); } }); }); }