1$(document).ready(function(){ 2 3 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 // shipping use invoiceaddress Function 5 // 6 $('#shipping_use_invoiceaddress').on('click', function(e) { 7 if($('#shipping_use_invoiceaddress').is(':checked') == true) 8 { 9 $('#shipping_use_invoiceaddress').val(0); 10 $('.spedizione').prop("disabled",true); 11 }else if($('#shipping_use_invoiceaddress').is(':checked') != true) 12 { 13 $('#shipping_use_invoiceaddress').val(1); 14 $('.spedizione').prop("disabled",false); 15 } 16 17 }) 18 // fine 19 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 20 21 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 22 // Prosegui buttone in Step 3 23 // 24 $('#next_step_3').on('click', function(e) { 25 var console_control = $("#console_v").val(); 26 var alert_control = $("#alert_v").val(); 27 var err = false; 28 $("#divMetodoSpedazione2").hide(); 29 $("#divMetodoSpedazione3").hide(); 30 var ordine1 = $('#ordine').val(); 31 var userid2 = $('#userid').val(); 32 var error = ""; 33 var checkBox = $("#shipping_use_invoiceaddress"); 34 var vlInput = $("#spedizione"); 35 var ValCheckBox = 0; 36 var zone_id_In_Sp = $("#state").val(); 37 var that = $('#ordine_spedizione'), 38 url = that.attr('action'), 39 type = that.attr('method'), 40 data = {}; 41 42 that.find('[name]').each(function(index, value){ 43 var that = $(this), 44 name = that.attr('name'), 45 value = that.val(); 46 47 data[name] = value; 48 }); 49 50 if(console_control > 0) 51 { 52 //console.log("Indirzzo spedizione"); 53 54 } 55 56 if($('#shipping_use_invoiceaddress').is(':checked') != true) 57 { 58 if($('#nameS').val() == "") 59 { 60 $('#nameS').addClass('input-border'); 61 err=true; 62 }else 63 { 64 $('#nameS').removeClass('input-border'); 65 66 } 67 68 if($('#surnameS').val() == "") 69 { 70 $('#surnameS').addClass('input-border'); 71 err=true; 72 }else 73 { 74 $('#surnameS').removeClass('input-border'); 75 76 } 77 78 if($('#addressS').val() == "") 79 { 80 $('#addressS').addClass('input-border'); 81 err=true; 82 }else 83 { 84 $('#addressS').removeClass('input-border'); 85 86 } 87 88 if($('#civicS').val() == "") 89 { 90 $('#civicS').addClass('input-border'); 91 err=true; 92 }else 93 { 94 $('#civicS').removeClass('input-border'); 95 96 } 97 98 if($('#capS').val() == "") 99 { 100 $('#capS').addClass('input-border'); 101 err=true; 102 }else 103 { 104 $('#capS').removeClass('input-border'); 105 106 } 107 108 if($('#cityS').val() == "") 109 { 110 $('#cityS').addClass('input-border'); 111 err=true; 112 }else 113 { 114 $('#cityS').removeClass('input-border'); 115 116 } 117 118 if($('#provS').val() == "") 119 { 120 $('#provS').addClass('input-border'); 121 err=true; 122 }else 123 { 124 $('#provS').removeClass('input-border'); 125 126 } 127 128 if($('#stateS').val() == "") 129 { 130 $('#stateS').addClass('input-border'); 131 err=true; 132 }else 133 { 134 $('#stateS').removeClass('input-border'); 135 136 } 137 138 var phone = $('#phoneS').val(); 139 var mobile = $('#mobileS').val(); 140 var fax = $('#faxS').val(); 141 var regexPattern=new RegExp(/^[0-9-+]+$/); 142 143 if($('#phoneS').val() == "" || regexPattern.test(phone) == false) 144 { 145 $('#phoneS').addClass('input-border'); 146 err=true; 147 }else 148 { 149 $('#phoneS').removeClass('input-border'); 150 151 } 152 153 if($('#mobileS').val().length > 0) 154 { 155 if($('#mobileS').val() == "" ||regexPattern.test(mobile) == false) 156 { 157 $('#mobileS').addClass('input-border'); 158 err=true; 159 }else 160 { 161 $('#mobileS').removeClass('input-border'); 162 } 163 } 164 165 if($('#faxS').val().length > 0) 166 { 167 if($('#faxS').val() == "" || regexPattern.test(fax) == false) 168 { 169 $('#faxS').addClass('input-border'); 170 err=true; 171 }else 172 { 173 $('#faxS').removeClass('input-border'); 174 } 175 } 176 177 if (err==true) { 178 return false;
179 180 }else{ 181 182 $.ajax({ 183 url : "step-spedizione.php", 184 type : "POST", 185 async: false, 186 data : data, 187 success: function(data) 188 { 189 if(console_control >0) 190 { 191 192 //console.log("befor"); 193 //console.log(data); 194 //console.log("after"); 195 } 196 197 $.ajax({ 198 url : "step-spedizione.php", 199 type : "POST", 200 async: false, 201 data : {"userid": userid2,"ordine": ordine1,"address_type": 1}, 202 success: function(data) 203 { 204 var getAddress = jQuery.parseJSON(data); 205 //console.log(getAddress['id_zona']); 206 $.ajax({ 207 url : "step-spedizione.php", 208 type : "POST", 209 async: false, 210 data : {"odercomplate": ordine1}, 211 success: function(data) 212 { 213 var orderT = jQuery.parseJSON(data); 214 if(orderT['payment_method_id'] > 0) 215 { 216 $("input[name='pm']").val(orderT['payment_method_id']) 217 218 } 219 220 $.ajax({ 221 url : "step-method-spedizione.php", 222 type :"POST", 223 async: false, 224 data : {"ordine": ordine1 , "userid": userid2 ,"error": error }, 225 success: function(data) 226 { 227 var getCartOrder = jQuery.parseJSON(data); 228 if(console_control > 0) 229 { 230 //console.log(getCartOrder); 231 } 232 233 var prodotto_virtuale = 0; 234 var prodotto_fisico=0; 235 var total = 0; 236 getCartOrder.forEach(function(entry) { 237 if(console_control > 0) 238 { 239 //console.log(entry); 240 } 241 242 total += entry["price"] * entry["qty"]; 243 244 if(entry["id_categoria"] == 10) 245 { 246 prodotto_fisico +=1; 247 }else if(entry["id_categoria"] == 1) 248 { 249 prodotto_virtuale +=1 ; 250 } 251 252 }); 253 // 0 = solo digitale, 1 = solo fisico, 2 = misto 254 var tipo_prodotto = 0; 255 256 if((prodotto_virtuale>0) && (prodotto_fisico==0)) { 257 tipo_prodotto=0; 258 }else if((prodotto_virtuale==0) && (prodotto_fisico>0)) { 259 tipo_prodotto=1; 260 }else if((prodotto_virtuale>0) && (prodotto_fisico>0)) { 261 tipo_prodotto=2; 262 } 263 264 265 $.ajax({ 266 url : "step-spedizione.php", 267 type : "POST", 268 async: false, 269 data : { "prepayment": tipo_prodotto , "zone_id": getAddress['id_zona'] , "error": "" }, 270 success: function(data) 271 { 272 var Methods_Mp = jQuery.parseJSON(data); 273 274 Methods_Mp.forEac
274h(function(pm){ 275 276 277 if(orderT['payment_method_id'] == pm['id']) 278 { 279 /* 280 if(pm['pay_on_delivery'] > 0) 281 { 282 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+" [Costo: "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>") 283 }else 284 { 285 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 286 }*/ 287 288 if(tipo_prodotto == 0) 289 { 290 if(pm['id'] == 1) 291 { 292 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 293 } 294 295 }else if(tipo_prodotto == 2){ 296 if(pm['id'] != 2 && pm['id'] != 3) 297 { 298 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 299 } 300 }else{ 301 if(pm['id'] == 2) 302 { 303 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+" ["+costo+": "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>"); 304 }else 305 { 306 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 307 } 308 } 309 310 }else 311 { /* 312 if(pm['pay_on_delivery'] > 0) 313 { 314 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+" [Costo: "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>") 315 }else 316 { 317 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 318 }*/ 319 320 if(tipo_prodotto == 0) 321 { 322 if(pm['id'] == 1) 323 { 324 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 325 } 326 327 }else if(tipo_prodotto == 2){ 328 if(pm['id'] != 2 && pm['id'] != 3) 329 { 330 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 331 } 332 }else{ 333 if(pm['id'] == 2) 334 { 335 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+" ["+costo+": "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>"); 336 }else 337 { 338 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 339 } 340 } 341 342 } 343 344 if(pm['id'] == 2) 345 { 346 $("#cost-contra").val(pm['contrassegno']); 347 } 348 349 }) 350 $.ajax({ 351 url : "step-riepilogo-concludi.php", 352 type :"POST", 353 data : {"ordine": ordine1, "current_step": 2},
354 success: function(response) 355 {} 356 }) 357 358 $.ajax({ 359 url : "step-riepilogo.php", 360 type :"POST", 361 data : {"ordine": ordine1 , "userid": userid2 , "address_type": 0 }, 362 success: function(data) 363 { 364 var invoice_address = jQuery.parseJSON(data); 365 if(console_control > 0) 366 { 367 //console.log(invoice_address); 368 } 369 370 //+++++++++++++++++++++++++++++++++++++++++++++++++++++ 371 // 372 // Ajax per getAddress con address_type 1 373 374 $.ajax({ 375 url : "step-riepilogo.php", 376 type :"POST", 377 data : {"ordine": ordine1 , "userid": userid2 , "address_type": 1 }, 378 success: function(data) 379 { 380 var shipping_address = jQuery.parseJSON(data); 381 if(console_control > 0) 382 { 383 //console.log(shipping_address); 384 } 385 $("#Ragione_sociale_Fatturazione").empty(); 386 $("#nameFatturazione").empty(); 387 $("#addressFatturazione").empty(); 388 $("#capFatturazione").empty(); 389 $("#partite_iva").empty(); 390 $("#Ragione_sociale_Fatturazione").append(invoice_address["ragione_sociale"]); 391 $("#nameFatturazione").append(invoice_address["name"]+ " " + invoice_address["surname"]); 392 $("#addressFatturazione").append(invoice_address["address"]+","+invoice_address['civic']); 393 $("#capFatturazione").append(invoice_address["city"]+" "+invoice_address['cap']+" "+invoice_address['prov']); 394 $("#partite_iva").append(invoice_address["piva"]); 395 $.ajax({ 396 url : "step-riepilogo.php", 397 type :"POST", 398 data : {"state_id": invoice_address["state_id"] },
399 success: function(data) 400 { 401 var state_id = jQuery.parseJSON(data); 402 $("#stateFatturazione").empty(); 403 $("#stateFatturazione").append(state_id["denominazione"]); 404 } 405 }) 406 407 if( shipping_address == null || shipping_address["shipping_use_invoiceaddress"] == 0 ) 408 { 409 $("#Ragione_sociale_S").empty(); 410 $("#nameSpedizione").empty(); 411 $("#addressSpedizione").empty(); 412 $("#capSpedizione").empty(); 413 $("#Ragione_sociale_S").append(invoice_address["ragione_sociale"]); 414 $("#nameSpedizione").append(invoice_address["name"]+ " " + invoice_address["surname"]); 415 $("#addressSpedizione").append(invoice_address["address"]+","+invoice_address['civic']); 416 $("#capSpedizione").append(invoice_address["city"]+" "+invoice_address['cap']+" "+invoice_address['prov']); 417 $.ajax({ 418 url : "step-riepilogo.php", 419 type :"POST", 420 data : {"state_id": invoice_address["state_id"] }, 421 success: function(data) 422 { 423 var state_id = jQuery.parseJSON(data); 424 $("#stateSpedizione").empty(); 425 $("#stateSpedizione").append(state_id["denominazione"]); 426 } 427 }) 428 }else 429 { 430 431 $("#Ragione_sociale_S").empty(); 432 $("#nameSpedizione").empty(); 433 $("#addressS
433pedizione").empty(); 434 $("#capSpedizione").empty(); 435 $("#Ragione_sociale_S").append(shipping_address["ragione_sociale"]); 436 $("#nameSpedizione").append(shipping_address["name"]+ " " + shipping_address["surname"]); 437 $("#addressSpedizione").append(shipping_address["address"]+","+shipping_address['civic']); 438 $("#capSpedizione").append(shipping_address["city"]+" "+shipping_address['cap']+" "+shipping_address['prov']); 439 $.ajax({ 440 url : "step-riepilogo.php", 441 type :"POST", 442 data : {"state_id": shipping_address["state_id"] }, 443 success: function(data) 444 { 445 var state_id = jQuery.parseJSON(data); 446 $("#stateSpedizione").empty(); 447 $("#stateSpedizione").append(state_id["denominazione"]); 448 } 449 }) 450 } 451 452 } 453 }) 454 455 } 456 }) 457 $.ajax({ 458 url : "step-riepilogo-concludi.php", 459 type :"POST", 460 data : {"ordine": ordine1,"current_step":2}, 461 success: function(response) 462 { 463 //alert("ok") 464 } 465 }) 466 $('#field_indirizzo_spedizione').hide("slow"); 467 $('#slide_modalita_pagamenteo').show("slow"); 468 } 469 }) 470 471 } 472 }) 473 474 475 } 476 }) 477 } 478 }) 479 480 481 482 } 483 484 }) 485 } 486 487 }else{ 488 $.ajax({ 489 url : "step-spedizione.php", 490 type : "POST", 491 async: false, 492 data : data, 493 success: function(data) 494 { 495 496 } 497 }) 498 499 $.ajax({ 500 url : "step-spedizione.php", 501 type : "POST", 502 async: false, 503 data : {"userid": userid2,"ordine": ordine1,"address_type": 0}, 504 success: function(data) 505 { 506 var getAddress = jQuery.parseJSON(data); 507 //console.log(getAddress); 508 509 $.ajax({ 510 url : "step-spedizione.php", 511 type : "POST", 512 async: false, 513 data : {"odercomplate": ordine1}, 514 success: function(data) 515 { 516 var orderT = jQuery.parseJSON(data); 517 if(orderT['payment_method_id'] > 0) 518 { 519 $("input[name='pm']").val(orderT['payment_method_id']) 520 521 } 522 523 $.ajax({ 524 url : "step-method-spedizione.php", 525 type :"POST", 526 async: false, 527 data : {"ordine": ordine1 , "userid": userid2 ,"error": error }, 528 success: function(data) 529 { 530 var getCartOrder = jQuery.parseJSON(data); 531 if(console_control > 0) 532 { 533 //console.log(getCartOrder); 534 } 535 536 var prodotto_virtuale = 0; 537 var prodotto_fisico=0; 538 var total = 0; 539 getCartOrder.forEach(function(entry) { 540 if(console_control > 0) 541 { 542 //console.log(entry); 543 } 544 545 total += entry["price"] * entry["qty"]; 546 547 if(entry["id_categoria"] == 10) 548 { 549 prodotto_fisico +=1; 550 }else if(entry["id_categoria"] == 1) 551 { 552 prodotto_virtuale +=1; 553 } 554 555 }); 556 557 // 0 = solo digitale, 1 = solo fisico, 2 = misto 558 var tipo_prodotto = 0; 559 560 if((prodotto_virtuale>0) && (prodotto_fisico==0)) { 561 tipo_prodotto=0; 562 }else if((prodotto_virtuale==0) && (prodotto_fisico>0)) { 563 tipo_prodotto=1; 564 }else if((prodotto_virtuale>0) && (prodotto_fisico>0)) { 565 tipo_prodotto=2; 566 } 567 568 $.ajax({ 569 url : "step-spedizione.php", 570 type : "POST", 571 async: false, 572 data : { "prepayment": tipo_prodotto , "zone_id": getAddress['id_zona'] , "error": "" }, 573 success: function(data) 574 { 575 var Methods_Mp = jQuery.parseJSON(data); 576 Methods_Mp.forEac
576h(function(pm){ 577 578 if(orderT['payment_method_id'] == pm['id']) 579 { 580 /* 581 if(pm['pay_on_delivery'] > 0) 582 { 583 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+" [Costo: "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>") 584 }else 585 { 586 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 587 }*/ 588 589 if(tipo_prodotto == 0) 590 { 591 if(pm['id'] == 1) 592 { 593 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 594 } 595 596 }else if(tipo_prodotto == 2){ 597 if(pm['id'] != 2 && pm['id'] != 3) 598 { 599 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 600 } 601 }else{ 602 if(pm['id'] == 2) 603 { 604 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+" ["+costo+": "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>"); 605 }else 606 { 607 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' checked/> "+pm['name']+"<br>"); 608 } 609 } 610 611 }else 612 { /* 613 if(pm['pay_on_delivery'] > 0) 614 { 615 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+" [Costo: "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>") 616 }else 617 { 618 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 619 }*/ 620 621 if(tipo_prodotto == 0) 622 { 623 if(pm['id'] == 1) 624 { 625 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 626 } 627 628 }else if(tipo_prodotto == 2){ 629 if(pm['id'] != 2 && pm['id'] != 3) 630 { 631 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 632 } 633 }else{ 634 if(pm['id'] == 2) 635 { 636 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+" [Costo: "+parseInt(pm['contrassegno']).toFixed(2)+ "â¬]"+"<br>"); 637 }else 638 { 639 $("#list_Mp").append("<input type='radio' name='pm' value='"+pm['id']+"' /> "+pm['name']+"<br>"); 640 } 641 } 642 643 } 644 645 if(pm['id'] == 2) 646 { 647 $("#cost-contra").val(pm['contrassegno']); 648 } 649 650 }) 651 $.ajax({ 652 url : "step-riepilogo-concludi.php", 653 type :"POST", 654 data : {"ordine": ordine1, "current_step": 2},
655 success: function(response) 656 { 657 658 } 659 }) 660 } 661 }) 662 } 663 }) 664 665 } 666 }) 667 } 668 }) 669 670 $('#field_indirizzo_spedizione').hide("slow"); 671 $('#slide_modalita_pagamenteo').show("slow"); 672 } 673 return false; 674 }) 675 // fine 676 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 677 678 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 679 // Step 3 Torna indietro 680 // 681 682 $('#next_step-2').on('click', function(e) { 683 $("#list_Mp").empty(); 684 var address_type = $('#address_type').val(); 685 var state = $('#state1').val(); 686 var ordine = $('#ordine').val(); 687 var userid = $('#userid').val(); 688 $.ajax({ 689 url : "step-fatturazione.php", 690 type : "POST", 691 async: false, 692 data : {"userid_F": userid ,"ordine_F": ordine,"address_type": address_type}, 693 success: function(data) 694 { 695 var getAddress = jQuery.parseJSON(data); 696 if(getAddress == null) 697 { 698 getAddress = ""; 699 700 }else; 701 $.ajax({ 702 url : "step-fatturazione.php", 703 type : "POST", 704 async: false, 705 data : {"userid": userid , "ordine": ordine , "address_type": 1 }, 706 success: function(data) 707 { 708 var address_Sp = jQuery.parseJSON(data); 709 if(address_Sp == null || address_Sp['shipping_use_invoiceaddress'] == 0) 710 { 711 $.ajax({ 712 url : "step-fatturazione.php", 713 type : "POST", 714 async: false, 715 data : {"userid": userid , "ordine": ordine, "state": state }, 716 success: function(data) 717 { 718 $("#val_state_id").val(getAddress["state_id"]); 719 $("#state1").val(getAddress["state_id"]); 720 721 } 722 723 }); 724 725 726 $('#shipping_use_invoiceaddress').prop('checked', true); 727 if($('#shipping_use_invoiceaddress').is(':checked') == true) 728 { 729 $('.spedizione').prop("disabled",true); 730 }else; 731 732 } 733 734 $.ajax({ 735 url : "step-riepilogo-concludi.php", 736 type :"POST", 737 data : {"ordine": ordine,"current_step":1}, 738 success: function(response) 739 { 740 //console.log(response); 741 } 742 }) 743 } 744 745 }) 746 } 747 }) 748 $.ajax({ 749 url : "step-riepilogo-concludi.php", 750 type :"POST", 751 data : {"ordine": ordine , "current_step": 1}, 752 success: function(response) 753 { 754 755 } 756 }) 757 $('#field_indirizzo_spedizione').show("slow"); 758 $('#slide_modalita_pagamenteo').hide("slow"); 759 e.preventDefault(); 760 }) 761 762})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.