INFO: Charging Customers Tax Based on Zip Code within Commerce Server
ID: Q229780
|
The information in this article applies to:
-
Microsoft Site Server version 3.0, Commerce Edition
SUMMARY
To charge tax based upon zip code, it is necessary to create a table in the "Commerce" database with a zip code column and a rate column.
For example, create a table called zip_tax with the fields tax_rate and zip and populate the table with the necessary zip codes and corresponding tax rates.
It is then necessary to create a scriptor component in the pipeline editor to replace the existing tax component (probably in \config\plan.pcf) and utilize a script similar to the following:
Function mscsexecute(config, orderform, context, flags)
Dim connection, sqlstmt, RS
Set connection = CreateObject("ADODB.Connection")
connection.open(context.DefaultConnectionString)
SQLStmt = "select tax_rate from zip_tax where zip = " & orderform.bill_to_zip
Set RS = connection.Execute(sqlstmt)
orderform.[_tax_total] = rs.fields("tax_rate").value * orderform.[_oadjust_subtotal] *.01
orderform.[_tax_included] = 0
Connection.close
Set connection = Nothing
MSCSExecute = 1
end function
The scriptor takes the orderform.bill_to_zip value that is already instantiated. The scriptor then looks up the corresponding tax rate and multiplies it by the order subtotal "orderform.[_oadjust_subtotal]"
NOTE: The scriptor multiplies the "tax_rate" by .01 because the tax_rate field is an integer value.
Additional query words:
Keywords : prodCS kbinfo
Version : winnt:3.0
Platform : winnt
Issue type : kbinfo