shipping, taxes, grand total, (help with script) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

shipping, taxes, grand total, (help with script)

GreyHoundGreyHound Posts: 1Member
Hi,

Can someone please help me with this script?
I am trying to use this script on a confirmation page
to show: shipping, taxes, grand total.

The problem i am having is: the shipping is the only part that displays
correctly, the salesTax only returns a value of $0.00 and the grandTotal
is not adding the subtotal+salesTax+Shipping but instead, is showing the
subtotal and shipping on the same line. example: subtotal=$80.00+Shipping
=$7.95 It displays as $807.95 Can any one help me out on this?
<%
var UCCart1_subTotal = UCCart1.GetColumnTotal("Total");
var UCCart1_salesTax = 0;
var UCCart1_salesTaxRate = 0;
var TaxState = Request.Form("BillState")
if (TaxState == "NY")
{
UCCart1_salesTaxRate = 0.45;
UCCart1_salesTax=UCCart1_salesTaxRate*UCCart1_subTotal;
}
var UCCart1_ShipCost = (Request.Cookies("cookieShippingCost"));
var UCCart1_grandTotal=UCCart1_subTotal+UCCart1_salesTax+UCCart1_ShipCost;
Session("grandTotal") = UCCart1_grandTotal
%>

Nelson.


Comments

  • xapisxapis Posts: 5Member
    You need to convert your values from string to numeric, and then add them:
    UCCart1_subTotal = UCCart1_subTotal - 0;
    UCCart1_salesTax = UCCart1_salesTax - 0;
    UCCart1_ShipCost = UCCart1_ShipCost - 0;
    UCCart1_grandTotal=UCCart1_subTotal+UCCart1_salesTax+UCCart1_ShipCost;

    Otherwise it will treat the values as string and concatenate the characters. To convert from numeric to string do this:
    UCCart1_subTotal = UCCart1_subTotal + "";



    : Hi,
    :
    : Can someone please help me with this script?
    : I am trying to use this script on a confirmation page
    : to show: shipping, taxes, grand total.
    :
    : The problem i am having is: the shipping is the only part that displays
    : correctly, the salesTax only returns a value of $0.00 and the grandTotal
    : is not adding the subtotal+salesTax+Shipping but instead, is showing the
    : subtotal and shipping on the same line. example: subtotal=$80.00+Shipping
    : =$7.95 It displays as $807.95 Can any one help me out on this?
    : <%
    : var UCCart1_subTotal = UCCart1.GetColumnTotal("Total");
    : var UCCart1_salesTax = 0;
    : var UCCart1_salesTaxRate = 0;
    : var TaxState = Request.Form("BillState")
    : if (TaxState == "NY")
    : {
    : UCCart1_salesTaxRate = 0.45;
    : UCCart1_salesTax=UCCart1_salesTaxRate*UCCart1_subTotal;
    : }
    : var UCCart1_ShipCost = (Request.Cookies("cookieShippingCost"));
    : var UCCart1_grandTotal=UCCart1_subTotal+UCCart1_salesTax+UCCart1_ShipCost;
    : Session("grandTotal") = UCCart1_grandTotal
    : %>
    :
    : Nelson.
    :
    :


Sign In or Register to comment.