close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Error in eCart code

Thread began 11/08/2009 10:55 am by markdoyle87077 | Last modified 11/10/2009 11:48 am by markdoyle87077 | 3563 views | 9 replies

markdoyle87077

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

Attached Files
eCart.zip

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...