treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wp-ecommerce problem plz help

  • I m trying to change the total price depending on payment method .
    I’ve made it with jquery in cart page
    but i cant do anything with php im updating
    $_SESSION['wpsc_cart->total_price'] but when trasfering the price on database and sending the email total price doesnt changes ….
    My jquery code is below
    var pric= $(‘.wpsc_totals #checkout_total .pricedisplay’).html();
    var priceAsFloat = function (pric) {
    return parseFloat(pric.replace(/\./g, ”).replace(/,/g,’.').replace(/[^\d\.]/g,”), 10);
    }
    var pri= priceAsFloat(pric);
    var newprice= pri +4.00;
    $(document).ready(function(){
    test=$(“input[value$='wpsc_merchant_testmode']:radio:checked”).val();
    if( test==”wpsc_merchant_testmode”){
    $(“#checkout_total .pricedisplay”).html(newprice);
    }
    else{
    $(“#checkout_total .pricedisplay”).html(pric);
    }
    $(“input[name$='custom_gateway']“).click(function() {
    test=$(“input[value$='wpsc_merchant_testmode']:radio:checked”).val();
    if( test==”wpsc_merchant_testmode”){
    $(“#checkout_total .pricedisplay”).html(newprice);
    }
    else{
    $(“#checkout_total .pricedisplay”).html(pric);
    }
    });
    });

    and php code that i have made but not working is
    $total = $wpsc_cart->calculate_subtotal();
    $total += $wpsc_cart->calculate_total_shipping();
    $newtotal= $total + 4;
    ….
    total_price’]=$newtotal;?>

    I want to do that thing because my delivery services asks for 4 aditional euros if they get paid when the product delievered to the customer:(
    Plz give some help i cant understand how that works:)