Page 1 of 1

Sales tax calculation

Posted: Tue Sep 23, 2008 1:34 pm
by awhc
I need to customize the sales tax calculation but don't know where to add my code. Basically, I have a custom table set up to retrieve tax rates based on zip codes (worldwide). I'm using this information to automatically populate the order form fields of BillToCity and BillToProvince. That part works fine. However, I can't find where/when the actual tax calculation takes place. I have my taxrates available from the database but don't know where to plug them in. Can someone point me in the right direction as to what page(s) this should be added to and what functions/classes/etc should be involved? Thanks.

Re: Sales tax calculation

Posted: Tue Sep 23, 2008 9:32 pm
by mazhar
TaxCalculator class is used to calculate the tax. Basket class makes use of this TaxCalculator class on checkout to calculate the tax.

Re: Sales tax calculation

Posted: Wed Sep 24, 2008 8:26 am
by awhc
Thanks mazhar. Now that I know what class to use, I need to know where to put the code. I've looked over the code on a few pages such as "placeorder2" and "vieworder" but I don't see any type of calculation. I even did a search for "TaxCalculator" through the whole solution but found no reference. Can you tell me what page(s) is used for the calculation and where I should add the code?

Re: Sales tax calculation

Posted: Wed Sep 24, 2008 9:27 pm
by mazhar
This call to TaxCalculator actually lies inside the Basket class's Checkout method mean that this code is inside the CommerceBuilder API. For your customization i think you may need to write custom tax provider. Please have a look at the following link
http://wiki.ablecommerce.com/index.php/ ... x_Provider

Re: Sales tax calculation

Posted: Thu Sep 25, 2008 12:20 pm
by awhc
Thanks again mazhar. I will write my own tax provider class. Next question is, on what page (and when) do I add the call to my new tax provider class? One spot I was thinking about trying is on the PlaceOrder2.aspx.cs page in the "PlaceOrderButton_Click" event handler, right before the call to _Basket.Recalculate(). Is that a good place or should I look elsewhere?

Re: Sales tax calculation

Posted: Thu Sep 25, 2008 11:29 pm
by mazhar
AbleCommerce will automatically use your customer TaxProvider. You don't need to write code for tax calculation. All you need to do is write your custom TaxProvider and configure it on the store.
Read the following post, some community members are discussing Avalara Tax Provider Integration. It may help you
viewtopic.php?f=42&t=5935&st=0&sk=t&sd= ... axProvider

Re: Sales tax calculation

Posted: Mon Sep 29, 2008 12:37 pm
by awhc
I will do that. Thanks again.

Re: Sales tax calculation

Posted: Wed Oct 01, 2008 1:38 pm
by awhc
Sorry to keep asking questions about this, but, I still don't get it. This keeps getting deeper and more frustrating for me and as my deadline approaches I get more stressed out. I have tried writing my own provider but obviously I'm doing some things wrong.
All I want to do with my in-house custom solution is look up my values in a table based on a zipcode, return the taxrate, make a tax calculation, and add the amount to the order. If I was writing my own app this would be no big deal. However, I'm having a hard time grasping how this API thing works. I'm a fairly new developer and I've always developed my own code until now. I need a little bit of hand holding on this, if that is possible.

- How do I create/add the custom provider?
- How do I connect to my database and pass a zipcode parameter to a stored procedure?
- How do I return this value to my custom provider?
- How do I connect the custom provider to the application?
- How do I do whatever else needs to be done?

I'm willing to send you some sample code or whatever it takes to fully explain what I'm trying to do.

Again, thanks for any help you can provide.

Re: Sales tax calculation

Posted: Mon Oct 06, 2008 12:50 pm
by mazhar
Please read the following post. It will be a great help for you, good folks have already discussed many uses full stuff here.
viewtopic.php?f=42&t=5935

Re: Sales tax calculation

Posted: Mon Oct 06, 2008 2:36 pm
by awhc
I did read that post but it didn't provide as much detail as I needed, since I'm so new to this. I did however find the solution to what I needed to do, through trial and error and a lot of debugging my own code. Thanks for your help.

Re: Sales tax calculation

Posted: Fri May 27, 2011 1:10 pm
by ImmortalLogic
If TaxCalculator.cs is designed to calculate the tax and I remove TaxCalculator.cs, I should not be able to view any tax calculated in my CheckOut. However, when I do remove the TaxCalculator.cs file, I still receive the calculated tax. Are there other files that perform the tax calculation?