Avatax Add-On for AspDotNetStorefront 8.0.1.2+

Applies To: AspDotNetStorefront versions 8.0.1.2 - 8.1.0.0

The Avatax Plug-in has been designed to work with AspDotNetStorefront version 8.0.1.2+. Because there is no add-in model for these versions, the Plug-in requires copying files into the file system of your ML site. The files to be copied include the ASPDNSFCore.dll and the ASPDNSFGateways.dll; therefore, if any source code changes have been made to these files, a merge of the differences will be required to preserve customizations. Otherwise, there should be no issue with replacing these .dlls with the ones in the install package.

Files included:

  • AspDotNetStorefrontCore.dll
  • AspDotNetStorefrontGateways.dll
  • Avalara.AvaTax.Adapter.dll
  • checkoutpayment.aspx.vb (.cs)
  • checkoutreview.aspx.vb (.cs)
  • shoppingcart.aspx.vb (.cs)
  • shoppingcart.aspx
  • UpdateSQL_8014.sql 
AppConfigs added:

  • TaxAddin.Enabled
  • TaxAddIn.DumpXMLOnCartPage
  • AvalaraAccount
  • AvalaraCompanyCode
  • AvalaraLicense
  • AvalaraServiceURL

AppConfigs required:

  • RTShipping origin information 

Installation Instructions (no source code changes)


  • Create and set the appropriate values for the AppConfigs
  • Copy the 3 dlls into the bin
  • Copy the 3 .cs or .vb files and one .aspx file into the root of the website
  • Excecute the sql script


Edit Section

Installation Instructions (source code changes)



All code changes can be analyzed by using a differences tool, such as ExamDiff or WinMerge. Alternatively, all code changes have been marked with "alp" and the changes noted. For ease of installation, 3 install options are are provided that will assist you.

  1. If you know you have not changed the source of a particular file in the list below, simply copy and replace the file on your file system.
  2. If you know you have not changed the source of a particular method in the list below, simply copy the entire method, which will be everything between the comments "alp - begin" and "alp - end".
  3. If you have made changes to these methods, each individual change is also flagged with "alp" and "end alp". Some one line changes will not have an "end" statement. This makes it easy to only put the changes in place needed for the tax adapter without having to copy the entire method.

Edit Section

Install Steps (using method copy)

  • Create and set the appropriate values for the AppConfigs
  • Copy the Avalara.Avatax.Adapter.dll into the bin of the website
  • Web files
    • checkoutpayment.aspx.vb (.cs) - set the Show Tax parameter to false in the 2 calls to DisplaySummary
    • checkoutreview.aspx.vb (.cs)
      • Global CartTotal added to class level declarations
      • Page_Load duplicate CartTotal declaration simplified so global applies
      • GetPaymentMethod - copy and paste of method
      • ProcessCheckout - copy and paste of method
    • shoppingcart.aspx - added label for displaying tax connection results, copy and paste into page
    • shoppingcart.aspx.vb (.cs)
      • btnRequest_Estimates_Click - copy and paste of method
  • ShoppingCart.vb (.cs)
    • DisplaySummary - copy and paste of method
    • TaxTotal - copy and paste of method
    • TaxTotalLineItem - copy and paste of method
    • SubTotal - copy and paste of method
    • Total - copy and paste of method
    • ShippingTotal - copy and paste of method
  • Gateway.vb (.cs)
    • Add import or using statement for System.Collections at top
    • CreateOrderRecord - copy and paste of method
    • MakeOrder - copy and paste of method
    • ProcessOrderAsCaptured - copy and paste of method
  • Create a folder called Avalara in the ASPDNSFCore project and add the Avalara.vb (.cs) file to this folder
  • Add a reference to the Avalara.Avatax.Adapter.dll in your bin to the ASPDNSFCore project

  • Recompile the ASPDNSFCore and ASPDNSFGateways projects and make sure the new .dlls are in the bin folder of your website.

  • Execute the SQL Script (always recommended to backup your database prior to executing a script)


Edit Section

Testing Your Installation


An AppConfig called TaxAddIn.DumpXMLOnCartPage has been provided to allow you to test your connection to the Avatax system. When this value is set to true, and a user clicks the "Get Estimate" button on the ShoppingCart page, the results of the connectivity test will display in the estimates panel. You will need to have the shipping and tax estimator turned on to do this test.

If your connectivity test passes, but your tax results are still not as expected, the Avatax Plug-in logs system error messages in the ErrorLog table in your SQL database.


Edit Section

Documentation of files that changed (6 files, 44 lines of code), 2 files added:



In the ASPDNSFCore project:
  • ShoppingCart.vb or ShoppingCart.cs
    • DisplaySummary - added an if statement to only call TaxTotal when ShowTax appconfig is true
    • TaxTotal - overloaded to send shipping totals by address and receive cart items from gateway
    • TaxTotalLineItem - overloaded to receive cart items and shipping totals items, tax add-in code here (calls to GetTaxRates)
    • Subtotal - advanced the results set due to a change in the stored procedure
    • Total - overloaded to receive cart items from gateway
    • ShippingTotal - overloaded to capture individual address shipping costs
  • Added a folder called Avalara that contains the Avalara.vb or Avalara.cs plug-in class library

In the ASPDNSFGateways project:
  • Gateway.vb or Gateway.cs
    • Import System.Collections
    • Overloaded CreateOrderRecord to receive a CartTotal, reduces calls to tax service
    • MakeOrder - collects multi-ship totals collection when an order is placed to go as shipping lines to the tax service
    • ProcessOrderAsCaptured - contains the code to commit the tax request

In the Web:
  • checkoutpayment.aspx.vb (.cs) - updated the 2 calls to DisplaySummary to be ShowTax = false
  • checkoutreview.aspx.vb (.cs) - created a global to hold CartTotal and prevent duplicate calls
  • shoppingcart.aspx - added an output label for the connectivity test
  • shoppingcart.aspx.vb (.cs) - added code for connectivity test when appconfig to dump xml is on
  • add the Avalara.AvaTax.Adapter.dll to the bin

In the database:
  • update to the aspdnsf_GetCartSubtotalandTax stored procedure - uncommented one of the debug flags to return the final discounted cart collection as part of the results sets 

Article ID: 45, Created On: 5/7/2014, Modified: 5/7/2014