• 29-07-2020, 19:59:53
    #1
    sorun çözülmüştür
  • 29-07-2020, 20:01:12
    #2
    $("#tfiyat").html((parseFloat(mt)*fiyat+10).toFixed(2) +"₺"););
    bu şekilde yaptığımda oluyor ancak posttan çekmesini istiyorum
  • 29-07-2020, 20:06:33
    #3
    var kagitFiyatSon=$("#kagitne").val();
    $("#tfiyat").html((parseFloat(mt)*fiyat+Number(kagitFiyatSont)).toFixed(2) +"₺"););
    Bunuda yemezse üzer : ) Olmaz ise AnyDesk veya Teamviewer gönderin bakalım : )
  • 29-07-2020, 20:09:03
    #4
    hocam çok teşekkürler oldu ancak anlık olarak güncellemiyor onu nasıl yapabiliriz
  • 29-07-2020, 20:10:54
    #5
    @TufanKeles; Komple javascript kodunu paylaş bakalım : )
  • 29-07-2020, 20:11:39
    #6
    var fiyatalani=jQuery(".price-wrapper").html();
    jQuery(".price-wrapper").remove();
    
    jQuery( document ).ready(function($) {
    
         $("#varyasyonaciklama").remove();
    $("#aciklama-goster").remove();
        $("#aciklamaalani").remove();
    
    var max_width = 1000000000;
    var max_height = 1000000000;
    var min_width = 1;
    var min_height = 1;
    var yeniresimadi=randomString(8);
    var resim=resimattr.url;
    var resimwidth=resimattr.size[0];
    var resimheight=resimattr.size[1];
    var canvaswidth=jQuery("#resimmm").width();
    var canvasheight=jQuery("#resimmm").height();
    var kagit_tipis=jQuery("#kagit_tipi")
    var jcrop_api;
    initJcrop(resim);
    function initJcrop(resim1)
    {
    $("#resimmm").attr('src',resim1);
    jcrop_api = $.Jcrop('#resimmm',{setSelect: [0, 0, canvaswidth, canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    };
    function initJcrop2(resim2)
    {
    jcrop_api.destroy();
    $("#resimmm").attr('src',resim2);
    jcrop_api = $.Jcrop('#resimmm',{setSelect: [0, 0, canvaswidth, canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    $("input[name='attribute_kagit-turu']").on('click',function(){
    setTimeout(function(){fiyatguncelle();},500);
    });
    $("#aciklama-goster").click(function(){
    if($("#aciklamaalani").css('display')=="none"){
    $("#aciklamaalani").show();
    }else{
    $("#aciklamaalani").hide();
    }
    });
    $("img.attachment-thumbnail").click(function(){
    var srcc=$(this).attr('src');
    initJcrop2(srcc);
    });
    
    $("#x").val(0);
    $("#x2").val(canvaswidth);
    $("#y").val(0);
    $("#y2").val(canvasheight);
    $("#w").val(canvaswidth);
    $("#h").val(canvasheight);
    
    
    jQuery('#width').val(canvaswidth);
    jQuery('#height').val(canvasheight);
    jQuery('#cw').val(canvaswidth);
    jQuery('#ch').val(canvasheight);
    var mt=(parseFloat(canvasheight)/100)*(parseFloat(canvaswidth)/100);
    $("#mt").html("="+mt.toFixed(2)+" m²");
    $("#tfiyat").html((parseFloat(mt.toFixed(2))*resimattr.fiyat).toFixed(2) +"₺");
    $( "input[name='quantity']" ).val(mt.toFixed(2));
    $("#width").change(function(){
    var width=$(this).val();
    var height=$("#height").val();
    var mt=(parseFloat(height)/100)*(parseFloat(width)/100);
    $( "input[name='quantity']" ).val(mt.toFixed(2));
         $("#width2").val(width);
    setOptions(width,height);
         resimguncelle();
    });
    
    $("#height").change(function(){
    var height=$(this).val();
    var width=$("#width").val();
    var mt=(parseFloat(height)/100)*(parseFloat(width)/100);
    $( "input[name='quantity']" ).val(mt.toFixed(2));
    setOptions(width,height);
         $("#height2").val(height);
         resimguncelle();
    });
    $('#grayscale').click(function() {
    resimguncelle();
    });
    $('#negate').click(function() {
    resimguncelle();
    });
    
    $('#sepia').click(function() {
    resimguncelle();
    });
    $('#blur').click(function() {
    resimguncelle();
    });
    $('#sharpen').click(function() {
    resimguncelle();
    });
    $('#emboss').click(function() {
    resimguncelle();
    });
    $("#flipv").click(function(){
    resimguncelle();
    });
    $("#fliph").click(function(){
    resimguncelle();
    });
    $("#rotate").click(function(){
    resimguncelle();
    });
    
    function setOptions (e,b) {
    var rat = parseInt(e) / parseInt(b);
    if(rat == canvaswidth/canvasheight) {
    if(canvaswidth >= canvasheight) {
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, canvasheight, canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    } else if (canvaswidth <= canvasheight)
    {
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, canvaswidth, canvaswidth],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    }
    if(rat >= canvaswidth/canvasheight) {
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, canvaswidth, (canvaswidth/rat)],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    if (rat < canvaswidth/canvasheight) {
    
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, (canvasheight*rat), canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    fiyatguncelle();
    }
    function showCoords(c)
    {
    $('#x').val(c.x);
    $('#y').val(c.y);
    $('#x2').val(c.x2);
    $('#y2').val(c.y2);
    $('#w').val(c.w);
    $('#h').val(c.h);
    };
    function randomString(len, charSet) {
    charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    var randomString = '';
    for (var i = 0; i < len; i++) {
    var randomPoz = Math.floor(Math.random() * charSet.length);
    randomString += charSet.substring(randomPoz,randomPoz+1);
    }
    return randomString;
    }
    function fiyatguncelle()
    {
    var fiyat="";
    var fiyatalan=$(".woocommerce-variation-price .wcpbc-price .woocommerce-Price-amount").html();
    if($(".woocommerce-variation-price .wcpbc-price .woocommerce-Price-amount").length)
    {
    fiyat=$(".woocommerce-variation-price .wcpbc-price .woocommerce-Price-amount").html().split(";")[1].replace(",",".");
    }else{
    fiyat=resimattr.fiyat;
    }
    var width=$("#width").val();
    var height=$("#height").val();
    var mt=$("input[name='quantity']" ).val();
    $("#mt").html("="+mt+" m²");
         var kagitFiyatSon=$("#kagitne").val();
    $("#tfiyat").html((parseFloat(mt)*fiyat+Number(kagitFiyatSon)).toFixed(2) +"₺");
    }
    function resimguncelle()
    {
    var image=$("#resimmm").attr('src');
    var x=$('#x').val();
    var y=$('#y').val();
    var x2=$('#x2').val();
    var y2=$('#y2').val();
    var w=$('#w').val();
    var cw=$('#cw').val();
    var h=$('#h').val();
    var ch=$('#ch').val();
    var rotate=$('#rotate').val();
    var grayscale=0;
    var negate=0;
    var sepia=0;
    var blur=0;
    var emboss=0;
    var fliph=0;
    var flipv=0;
    if($("#grayscale").prop('checked')== true)
    {
    grayscale=1;
    }
    if($("#negate").prop('checked')== true)
    {
    negate=1;
    }
    if($("#sepia").prop('checked')== true)
    {
    sepia=1;
    }
    if($("#blur").prop('checked')== true)
    {
    blur=1;
    }
    if($("#emboss").prop('checked')== true)
    {
    emboss=1;
    }
    if($("#flipv").prop('checked')== true)
    {
    flipv=1;
    }
    if($("#fliph").prop('checked')== true)
    {
    fliph=1;
    }
    var data = {
    action: "resimekle",
    resim:image,
    resimid:yeniresimadi,
    x:x,
    x2:x2,
    y:y,
    y2:y2,
    w:w,
    h:h,
    grayscale:grayscale,
    negate:negate,
    sepia:sepia,
    blur:blur,
    fliph:fliph,
    flipv:flipv,
    cw:cw,
    ch:ch,
    rotate:rotate
    };
    jQuery.post(resimattr.ajaxurl, data, function(response) {
    
    $("#duzenlenenresim").attr("src",response+ '?' + Math.random());
    $("#resimm").val(response);
    //$("#deneme").html(response);
    });
    }
    $(".jcrop-tracker").live('mouseup',function() {
    resimguncelle();
    });
    //console.log(resimattr.url);
    });
    @DPA; Buyurun hocamm
  • 29-07-2020, 20:14:23
    #7
    Clickleme sonrası 500MS fonksiyonu çalıştırmışsın bunu onkeyup olarak yapman gerekiyor oradaki timeout kaldır öncelikle daha sonrasında on.('click') kısmını on.('keyup') olarak değiştir yeterlidir : ) bunu da yemezse hakikaten üzer : )

    $("input[name='attribute_kagit-turu']").on('keyup',function(){
    fiyatguncelle();
    });
  • 29-07-2020, 20:18:02
    #8
    yapamadım hocam o alanı düzenleme şanısınız var mı?
    @DPA;
  • 29-07-2020, 20:21:31
    #9
    var fiyatalani=jQuery(".price-wrapper").html();
    jQuery(".price-wrapper").remove();
    
    jQuery( document ).ready(function($) {
    
    $("#varyasyonaciklama").remove();
    $("#aciklama-goster").remove();
    $("#aciklamaalani").remove();
    
    var max_width = 1000000000;
    var max_height = 1000000000;
    var min_width = 1;
    var min_height = 1;
    var yeniresimadi=randomString(8);
    var resim=resimattr.url;
    var resimwidth=resimattr.size[0];
    var resimheight=resimattr.size[1];
    var canvaswidth=jQuery("#resimmm").width();
    var canvasheight=jQuery("#resimmm").height();
    var kagit_tipis=jQuery("#kagit_tipi")
    var jcrop_api;
    initJcrop(resim);
    function initJcrop(resim1)
    {
    $("#resimmm").attr('src',resim1);
    jcrop_api = $.Jcrop('#resimmm',{setSelect: [0, 0, canvaswidth, canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    };
    function initJcrop2(resim2)
    {
    jcrop_api.destroy();
    $("#resimmm").attr('src',resim2);
    jcrop_api = $.Jcrop('#resimmm',{setSelect: [0, 0, canvaswidth, canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    // $("input[name='attribute_kagit-turu']").on('click',function(){
    // setTimeout(function(){fiyatguncelle();},500);
    // });
    $("input[name='attribute_kagit-turu']").on('keyup',function(){
        fiyatguncelle();
    });
    $("#aciklama-goster").click(function(){
    if($("#aciklamaalani").css('display')=="none"){
    $("#aciklamaalani").show();
    }else{
    $("#aciklamaalani").hide();
    }
    });
    $("img.attachment-thumbnail").click(function(){
    var srcc=$(this).attr('src');
    initJcrop2(srcc);
    });
    
    $("#x").val(0);
    $("#x2").val(canvaswidth);
    $("#y").val(0);
    $("#y2").val(canvasheight);
    $("#w").val(canvaswidth);
    $("#h").val(canvasheight);
    
    
    jQuery('#width').val(canvaswidth);
    jQuery('#height').val(canvasheight);
    jQuery('#cw').val(canvaswidth);
    jQuery('#ch').val(canvasheight);
    var mt=(parseFloat(canvasheight)/100)*(parseFloat(canvaswidth)/100);
    $("#mt").html("="+mt.toFixed(2)+" m²");
    $("#tfiyat").html((parseFloat(mt.toFixed(2))*resimattr.fiyat).toFixed(2) +"₺");
    $( "input[name='quantity']" ).val(mt.toFixed(2));
    $("#width").change(function(){
    var width=$(this).val();
    var height=$("#height").val();
    var mt=(parseFloat(height)/100)*(parseFloat(width)/100);
    $( "input[name='quantity']" ).val(mt.toFixed(2));
    $("#width2").val(width);
    setOptions(width,height);
    resimguncelle();
    });
    
    $("#height").change(function(){
    var height=$(this).val();
    var width=$("#width").val();
    var mt=(parseFloat(height)/100)*(parseFloat(width)/100);
    $( "input[name='quantity']" ).val(mt.toFixed(2));
    setOptions(width,height);
    $("#height2").val(height);
    resimguncelle();
    });
    $('#grayscale').click(function() {
    resimguncelle();
    });
    $('#negate').click(function() {
    resimguncelle();
    });
    
    $('#sepia').click(function() {
    resimguncelle();
    });
    $('#blur').click(function() {
    resimguncelle();
    });
    $('#sharpen').click(function() {
    resimguncelle();
    });
    $('#emboss').click(function() {
    resimguncelle();
    });
    $("#flipv").click(function(){
    resimguncelle();
    });
    $("#fliph").click(function(){
    resimguncelle();
    });
    $("#rotate").click(function(){
    resimguncelle();
    });
    
    function setOptions (e,b) {
    var rat = parseInt(e) / parseInt(b);
    if(rat == canvaswidth/canvasheight) {
    if(canvaswidth >= canvasheight) {
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, canvasheight, canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    } else if (canvaswidth <= canvasheight)
    {
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, canvaswidth, canvaswidth],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    }
    if(rat >= canvaswidth/canvasheight) {
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, canvaswidth, (canvaswidth/rat)],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    if (rat < canvaswidth/canvasheight) {
    
    jcrop_api.destroy();
    jcrop_api=$.Jcrop("#resimmm",{setSelect: [0, 0, (canvasheight*rat), canvasheight],onChange: showCoords,
    onSelect: showCoords,touchSupport:true,allowResize:false});
    }
    fiyatguncelle();
    }
    function showCoords(c)
    {
    $('#x').val(c.x);
    $('#y').val(c.y);
    $('#x2').val(c.x2);
    $('#y2').val(c.y2);
    $('#w').val(c.w);
    $('#h').val(c.h);
    };
    function randomString(len, charSet) {
    charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    var randomString = '';
    for (var i = 0; i < len; i++) {
    var randomPoz = Math.floor(Math.random() * charSet.length);
    randomString += charSet.substring(randomPoz,randomPoz+1);
    }
    return randomString;
    }
    function fiyatguncelle()
    {
    var fiyat="";
    var fiyatalan=$(".woocommerce-variation-price .wcpbc-price .woocommerce-Price-amount").html();
    if($(".woocommerce-variation-price .wcpbc-price .woocommerce-Price-amount").length)
    {
    fiyat=$(".woocommerce-variation-price .wcpbc-price .woocommerce-Price-amount").html().split(";")[1].replace(",",".");
    }else{
    fiyat=resimattr.fiyat;
    }
    var width=$("#width").val();
    var height=$("#height").val();
    var mt=$("input[name='quantity']" ).val();
    $("#mt").html("="+mt+" m²");
    var kagitFiyatSon=$("#kagitne").val();
    $("#tfiyat").html((parseFloat(mt)*fiyat+Number(kagitFiyatSon)).toFixed(2) +"₺");
    }
    function resimguncelle()
    {
    var image=$("#resimmm").attr('src');
    var x=$('#x').val();
    var y=$('#y').val();
    var x2=$('#x2').val();
    var y2=$('#y2').val();
    var w=$('#w').val();
    var cw=$('#cw').val();
    var h=$('#h').val();
    var ch=$('#ch').val();
    var rotate=$('#rotate').val();
    var grayscale=0;
    var negate=0;
    var sepia=0;
    var blur=0;
    var emboss=0;
    var fliph=0;
    var flipv=0;
    if($("#grayscale").prop('checked')== true)
    {
    grayscale=1;
    }
    if($("#negate").prop('checked')== true)
    {
    negate=1;
    }
    if($("#sepia").prop('checked')== true)
    {
    sepia=1;
    }
    if($("#blur").prop('checked')== true)
    {
    blur=1;
    }
    if($("#emboss").prop('checked')== true)
    {
    emboss=1;
    }
    if($("#flipv").prop('checked')== true)
    {
    flipv=1;
    }
    if($("#fliph").prop('checked')== true)
    {
    fliph=1;
    }
    var data = {
    action: "resimekle",
    resim:image,
    resimid:yeniresimadi,
    x:x,
    x2:x2,
    y:y,
    y2:y2,
    w:w,
    h:h,
    grayscale:grayscale,
    negate:negate,
    sepia:sepia,
    blur:blur,
    fliph:fliph,
    flipv:flipv,
    cw:cw,
    ch:ch,
    rotate:rotate
    };
    jQuery.post(resimattr.ajaxurl, data, function(response) {
    
    $("#duzenlenenresim").attr("src",response+ '?' + Math.random());
    $("#resimm").val(response);
    //$("#deneme").html(response);
    });
    }
    $(".jcrop-tracker").live('mouseup',function() {
    resimguncelle();
    });
    //console.log(resimattr.url);
    });
    @TufanKeles;