$(function() { $('.button_acquista').click(function() { var strID_Prodotto = $(this).attr('name'); if ( strID_Prodotto != '' && strID_Prodotto != undefined ) { var strProdottoTipo = 'proposta'; var strSKU = $(this).data('sku'); var strLogicaProposte = $('#logica_proposte').val(); var blnGo = true; if ( strLogicaProposte == 'camere' ) { var strServizi = ""; $('.servizio:enabled:checked').each(function(){ strServizi += ( strServizi != "" ? "," : "" ) + $(this).val() + "-" + ( $(this).data("idproposta") != "" && $(this).data("idproposta") != undefined ? $(this).data("idproposta") : "" ) + "-" + parseInt($('#intQServizi_'+$(this).val()).val()); }); var strCam_LogicaProposte = strLogicaProposte; var strCam_DaterangeIn = $('#daterange_in').val(); var strCam_DaterangeOut = $('#daterange_out').val(); var strCam_Daterange = ''; if ( strCam_DaterangeIn != '' && strCam_DaterangeIn != undefined ) { strCam_Daterange = strCam_DaterangeIn + " - " + strCam_DaterangeOut; } else { strCam_Daterange = $('#daterange').val(); } var strCam_Adulti = parseInt( $('#adults').val() ); var strCam_Bambini = parseInt( $('#children').val() ); var strCam_Notti = parseInt( $('#nights').val() ); /* + (noleggio:: giorni) */ var strCam_CheckIn = $('#checkin_time').val(); /* + (noleggio:: data_ritiro) */ var strCam_CheckOut = $('#checkout_time').val(); /* + (noleggio:: data_consegna) */ var strCam_Eta = $('#soglia_eta').val(); var strCam_Etas = $('#etas').val(); var strCam_Cart = parseInt( $('#cart').val() ); var strCam_totaleCarrello = parseFloat( $('#totaleCarrelloProposte').val() ); /* + (noleggio:: totaleCarrelloVeicoli) */ var strCam_totaleCarrelloBase = parseFloat( $('#totaleCarrelloProposteBase').val() ); // Totale prezzo senza servizi $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCarrello.php", data: "action=setCarrello" + "&pstrProdottoTipo=" + strProdottoTipo + "&pstrID_Prodotto=" + strID_Prodotto + "&pintQuantita=" + $("#fp_quantita").val() + "&pstrCarrelloTipo=" + $("#fp_carrello_tipo").val() + "&pstrLangCurrent=" + $("#fp_lang_current").val() + ( strServizi != "" ? "&pstrServizi=" + strServizi : "" ) + ( strCam_LogicaProposte != "" && strCam_LogicaProposte != undefined ? "&pstrCam_LogicaProposte=" + strCam_LogicaProposte : "" ) + ( strCam_Daterange != "" && strCam_Daterange != undefined ? "&pstrCam_Daterange=" + strCam_Daterange : "" ) + ( strCam_Adulti != "" && ! isNaN( strCam_Adulti ) ? "&pstrCam_Adulti=" + strCam_Adulti : "" ) + ( strCam_Bambini != "" && ! isNaN( strCam_Bambini ) ? "&pstrCam_Bambini=" + strCam_Bambini : "" ) + ( strCam_Notti != "" && ! isNaN( strCam_Notti ) ? "&pstrCam_Notti=" + strCam_Notti : "" ) + ( strCam_CheckIn != "" && strCam_CheckIn != undefined ? "&pstrCam_CheckIn=" + strCam_CheckIn : "" ) + ( strCam_CheckOut != "" && strCam_CheckOut != undefined ? "&pstrCam_CheckOut=" + strCam_CheckOut : "" ) + ( strCam_Eta != "" && strCam_Eta != undefined ? "&pstrCam_Eta=" + strCam_Eta : "" ) + ( strCam_Etas != "" && strCam_Etas != undefined ? "&pstrCam_Etas=" + strCam_Etas : "" ) + ( strCam_Cart != "" && ! isNaN( strCam_Cart ) ? "&pstrCam_Cart=" + strCam_Cart : "" ) + ( strCam_totaleCarrello != "" && strCam_totaleCarrello != undefined ? "&pstrCam_totaleCarrello=" + strCam_totaleCarrello : "" ) + ( strCam_totaleCarrelloBase != "" && strCam_totaleCarrelloBase != undefined ? "&pstrCam_totaleCarrelloBase=" + strCam_totaleCarrelloBase : "" ) + "&pstrImageFirst=" + $('#imageFirst').val(), success: function(data) { if ( data.status == 'ok' ) { resetRicerca(); $('#cart-number-items-a .cart-number-items').text( data.totale_prodotti ); $('#cart-number-items-a').removeClass('hide'); swal({ title: "Ok, la prenotazione è nel carrello!", text: "Continua a navigare oppure vai al carrello per completare l'ordine", type: "success", showCancelButton: true, cancelButtonText: "Continua", confirmButtonText: "Vai al carrello", closeOnConfirm: true }, function() { location.href = 'https://www.metour.it/zh/shopping-cart'; }); } else swal("Oops...", "包括在篮下失败。", "error"); }, error: function(data) { swal("Oops...", "过程没有完成。", "error"); } }); /* ajax */ } } }); });