Error in eCart code
Hi,
I have a rule as follows and it works fine, it is designed to calculate the tax at 19%:
<%
function WAEC_dmbp_SalesTax()
totalCharge = 0
if (true AND ((UBound(dmbp.Items) > 0) AND (( cStr(Session("TaxRate"))<>"" )))) then
totalCharge = totalCharge + ((WA_eCart_TotalColumn(dmbp, "TotalPrice") - (dmbp_GetDiscounts()) * 1) * (0.19))'Result
end if
WAEC_dmbp_SalesTax = WA_eCart_FormatNumber(totalCharge, dmbp.ForceDecimalsC, dmbp.DecimalPlacesC)
end function
%>
I have modified it as I want to get the tax from a database, I have set a session variable TaxRate to hold the data and I have modified the rule to:
<%
function WAEC_dmbp_SalesTax()
totalCharge = 0
if (true AND ((UBound(dmbp.Items) > 0) AND (( cStr(Session("TaxRate"))<>"" )))) then
totalCharge = totalCharge + ((WA_eCart_TotalColumn(dmbp, "TotalPrice") - (dmbp_GetDiscounts()) * 1) * Session("TaxRate"))'Result
end if
WAEC_dmbp_SalesTax = WA_eCart_FormatNumber(totalCharge, dmbp.ForceDecimalsC, dmbp.DecimalPlacesC)
end function
%>
The cart works fine on my ordersummary.asp page with this rule, however on my confirmdetails.asp page it throws the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "Germany"]'
/dmbc/WA_eCart/dmbp_VB.asp, line 260
I have checked the line entry and it points to the modified rule above, I know what the problem is but I do not know how to resolve it. The session TaxRate is showing as 0.19 on the ordersummary.asp page but when we go to the confirmdetails.asp page the session TaxRate is set to Germany although I have not changed the value of the session in my code.
I have attached the files, hope this helps. Cannot provide a working link as this would bring my site down.
Regards
Mark Doyle