Saadkhanani1 Posted May 16, 2018 Report Share Posted May 16, 2018 Can any buddy help me i need to add $ symbol on product_price and sub_total.. <script> $( document ).ready(function() { $(document).on("input paste keyup", ".product_qty", function( event ) { var product_quantity = 0; var product_price = 0; var gst_amount = 0; var sub_total = 0; var total_qty = 0; var grand_total = 0 product_quantity = $(this).val(); product_price = $(this).parent().prev().html(); sub_total = product_price * product_quantity; $(this).parent().next().html(sub_total); $('.product_qty' ).each( function( k, v ) { product_quantity = parseInt ( $(this).val() ) ? parseInt ( $(this).val() ) : 0; product_price = parseFloat($(this).parent().prev().html())?parseFloat($(this).parent().prev().html()):0; console.log(product_quantity); console.log(product_price); sub_total = parseFloat ( product_price * product_quantity ); console.log(sub_total); total_qty +=product_quantity; grand_total += sub_total; }); if ( grand_total > 0 ){ gst_amount = ( grand_total * 6 ) /100; } $("#total_qty").html(total_qty); $("#total_amount").html(grand_total); grand_total +=gst_amount; $("#gst_amount").html(gst_amount); $("#discount_amount").html(0); $("#grand_total").html(grand_total); }); // $(document).on("click", ".delete", function( event ) { var cart_item = 0; $(this).parent().parent().remove(); cart_item = $('.product_qty').length; if ( cart_item <= 0 ) { $("#total_qty").html('0'); $("#total_amount").html('0'); $("#gst_amount").html('0'); $("#discount_amount").html(0); $("#grand_total").html('0'); } else { $('.product_qty').trigger('keyup'); } }); }); </script> Quote Link to comment Share on other sites More sharing options...
0 Alison Posted May 21, 2018 Report Share Posted May 21, 2018 Hi. Just add "+' $' " after outputting needed variable. For example: $("#gst_amount").html(gst_amount + ' $'); $("#grand_total").html(grand_total + ' $'); Quote Link to comment Share on other sites More sharing options...
0 Kurumi Posted March 26, 2019 Report Share Posted March 26, 2019 Due to Caspio Releases, you may want to edit your script. Check this article for more information: https://howto.caspio.com/release-notes/caspio-bridge-13-0/13-0-impacted-areas/ Quote Link to comment Share on other sites More sharing options...
Question
Saadkhanani1
Can any buddy help me i need to add $ symbol on product_price and sub_total..
<script>
$( document ).ready(function() {
$(document).on("input paste keyup", ".product_qty", function( event ) {
var product_quantity = 0;
var product_price = 0;
var gst_amount = 0;
var sub_total = 0;
var total_qty = 0;
var grand_total = 0
product_quantity = $(this).val();
product_price = $(this).parent().prev().html();
sub_total = product_price * product_quantity;
$(this).parent().next().html(sub_total);
$('.product_qty' ).each( function( k, v ) {
product_quantity = parseInt ( $(this).val() ) ? parseInt ( $(this).val() ) : 0;
product_price = parseFloat($(this).parent().prev().html())?parseFloat($(this).parent().prev().html()):0;
console.log(product_quantity);
console.log(product_price);
sub_total = parseFloat ( product_price * product_quantity );
console.log(sub_total);
total_qty +=product_quantity;
grand_total += sub_total;
});
if ( grand_total > 0 ){
gst_amount = ( grand_total * 6 ) /100;
}
$("#total_qty").html(total_qty);
$("#total_amount").html(grand_total);
grand_total +=gst_amount;
$("#gst_amount").html(gst_amount);
$("#discount_amount").html(0);
$("#grand_total").html(grand_total);
});
//
$(document).on("click", ".delete", function( event ) {
var cart_item = 0;
$(this).parent().parent().remove();
cart_item = $('.product_qty').length;
if ( cart_item <= 0 )
{
$("#total_qty").html('0');
$("#total_amount").html('0');
$("#gst_amount").html('0');
$("#discount_amount").html(0);
$("#grand_total").html('0');
} else {
$('.product_qty').trigger('keyup');
}
});
});
</script>
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.