function checkOrderDelivery(){ var ok = true; var msg =''; $('.required').each(function() { if($(this).val().length < 1){ ok = false; $(this).css({'background-color': '#F99'}); } else { $(this).css({'background-color': '#fff'}); } }); if($('#delivery_same').attr('checked') == false) { $('.conditional').each(function() { if($(this).val().length < 1){ ok = false; $(this).css({'background-color': '#F99'}); } else { $(this).css({'background-color': '#fff'}); } }); } if(!ok) { alert('Zadejte dodací a fakturační údaje, děkujeme.'); } return ok; } function checkShippingAndPayment(e){ var rt = true; $.ajax({ type: 'POST', url: 'core/backworkers/isShippingAndPayment.php', data: { uid: '6606c659a8e46', client_id: '0'}, fail: function(){ alert("failed"); }, success: function(theResponse) { if(theResponse.trim() == "0") { alert("Zvolte si prosím způsob doručení a platby"); if(e != null) if(e.preventDefault) e.preventDefault(); else e.returnValue = false; rt = false; } }, async: false}); return rt; } function getPayments(deliveryId){ $.ajax({ type: "POST", data: {delivery: deliveryId, userId: '6606c659a8e46', client_id: '0' }, url: "/core/backworkers/getPaymentMethods.php", success: function(data){ $("#payment_table").html(data); } }); } function getShippings(){ $.ajax({ type: "POST", data: {userId: '6606c659a8e46', client_id: '0'}, url: "/core/backworkers/getShippingMethods.php", success: function(data){ $("#shipping_table").html(data); } }); } function paymentChanged(){ var id = $('input:radio[name=payment]:checked').val(); $.ajax({ type: 'POST', url: 'core/backworkers/SetPayment.php', data: { uid: '6606c659a8e46', payment_id: id, client_id: '0' }, fail: function(){ alert("failed"); }, success: function(theResponse) { // reloadCart(); // reloadCartSum(); actualizeSum(); }}); } function deliveryChanged(){ var id = $('input:radio[name=shipping]:checked').val(); $.ajax({ type: 'POST', url: 'core/backworkers/SetShipping.php', data: { uid: '6606c659a8e46', shipping_id: id, client_id: '0' }, fail: function(){ alert("failed"); }, success: function(theResponse) { // reloadCart(); // reloadCartSum(); actualizeSum(); }}); getPayments(id); } getPayments(); getShippings();