Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

WA state destination based sales tax


kidsngarden

Recommended Posts

One more thing: it doesn't calculate the shipping tax amount correctly when "use the following tax class" is selected in the shipping modules:

 

It seems to calculate the proper tax amount on products, but applies the default store tax rate on the shipping fees.

(example: $100 on products plus $10 shipping shipped to an address with a 7.6% tax from my store with a 8.9% tax rate will return

subtotal: $100.00

shipping: $10.00

tax = ($7.6 + $0.89 = $8.49)

 

could you confirm that this happens in your stores as well?

Link to comment
Share on other sites

  • Replies 274
  • Created
  • Last Reply

I will look into the shipping tax....you got it to correctly calculate your WA tax? How did you fix it?

 

 

One more thing: it doesn't calculate the shipping tax amount correctly when "use the following tax class" is selected in the shipping modules:

 

It seems to calculate the proper tax amount on products, but applies the default store tax rate on the shipping fees.

(example: $100 on products plus $10 shipping shipped to an address with a 7.6% tax from my store with a 8.9% tax rate will return

subtotal: $100.00

shipping: $10.00

tax = ($7.6 + $0.89 = $8.49)

 

could you confirm that this happens in your stores as well?

Link to comment
Share on other sites

the WA tax only calculates for customers with accounts. Customers checkout out without account are still presented the store tax rate. I tried to analyze how this worked, but my attempt was unsuccessful :-(

 

If somebody is gifted enough to play with the order.php class modifications, It would be great! I'm still working on it

Link to comment
Share on other sites

pixclinic, I only use fedex shipping. But I went into my module and set the tax class to taxable goods, then went and rearranged my order total to subtotal,shipping,tax and it correctly calculated the tax as (products+shipping)*sales tax=total sale.

 

I suspect you have a contrib that is interfering here...because the deug code I gave you before:

 

if (extension_loaded('curl')== 1){

echo 'cURL extension is installed.';

}

echo 'DOR rate: '.$resultString;

 

 

Should AT THE VERY LEAST print DOR rate: on the page. Something is preventing parse_DOR from being called. Um.....do you have a washington tax zone set up in admin? I believe it's possible your tax zone is identified differently than the default. Let me know.

 

You can try this and post the results.

 

4b. In /catalog/includes/functions/general.php

 

***FIND:***

//BOF WA State Tax Modification

if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal

//this customer is from Washington State,

//so attempt to get their tax rate based on order destination

$tax_rate= parse_DOR();

if ($tax_rate!='' && $tax_rate!='0') return $tax_rate ;

}

//EOF WA State Tax Modification

 

 

***REPLACE WITH:***//BOF WA State Tax Modification

if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal

//this customer is from Washington State,

//so attempt to get their tax rate based on order destination

echo 'This customer is in Washington,entering parse_DOR function.'.'<br>';

$tax_rate= parse_DOR();

if ($tax_rate!='' && $tax_rate!='0') return $tax_rate ;

}else{

echo 'Bypassing parse_DOR function, the customers zone code is: '.tep_get_zone_code($customer_country_id, $customer_zone_id, "").'<br>';

}

//EOF WA State Tax Modification

 

 

 

lildog

Link to comment
Share on other sites

lildog

 

As I mentionned before, I DO GET THE BEBUG QUOTES AND CONNECT FINE TO DOR WHEN CHECKING OUT WITH AN ACCOUNT. I first tried the contrib by checking WITHOUT AN ACCOUNT as a guest (MOD "purchase without account" by Ingo) and posted that it was not working at that time.

 

Again, read my previous posts, I know why it was not working. I still don't know how to make the guests without account having their tax rates calculated correctly.

 

I will double check again the amounts given by USPS and UPS modules when selected.

 

You may also try the site: www.thefrenchybee.com

Link to comment
Share on other sites

PixClinic

 

My applogies I missed the part where you mentioned it only doesn't work with PWA. I have it installed and will track it down.

 

lildog

Link to comment
Share on other sites

PixClinic

 

My applogies I missed the part where you mentioned it only doesn't work with PWA. I have it installed and will track it down.

 

lildog

 

:-)

 

thanks. I tried to play with the order class where PWA does the job, but I'm not a master in php classes :-(

Link to comment
Share on other sites

I will check my postage again too. I think I used an address that is in my stores zip so the tax would be my stores either way....oops. I will try again with a rate different than my stores.

 

 

lildog

Link to comment
Share on other sites

I will check my postage again too. I think I used an address that is in my stores zip so the tax would be my stores either way....oops. I will try again with a rate different than my stores.

 

 

lildog

 

I checked my postage with a differnet rate, it's fine, I must have messed up my math when upset by teh fact it was not working :-). No worries there!

Link to comment
Share on other sites

I have found the problem...it is in the parse_DOR function. There is an SQL query that gets the customers address from the database, PWA customers don't have their address in the database. So I will try to figure how to grab the necessary address variables and post an update.

 

lildog

Link to comment
Share on other sites

I have found the problem...it is in the parse_DOR function. There is an SQL query that gets the customers address from the database, PWA customers don't have their address in the database. So I will try to figure how to grab the necessary address variables and post an update.

 

lildog

 

Ahem.. If you read my previous posts, you will find out that I already mentioned this ;-)

Link to comment
Share on other sites

watermelon,

what exactly do you mean by hanging? Do your server script logs show anything? I would also start by seeing if cURL is installed, see my previous post.

 

lildog

 

 

It was a problem with the way that cURL was installed. Thanks!

PC

Link to comment
Share on other sites

I know you mentioned only registered customers used the new function but was confused by the fact you wanted to edit the orders class. it is an easy fix, I need to update my PWA though, thought I had the newest 2.0a version for 2.2rc2a. installed, since I wrote an update guide. But alas, I have an older version installed....hmmm. Give me a couple of hours to complete some more important stuff and write the update. There is an array that is created by PWA:$order->pwa_label_shipping that should give us the info we need.

 

lildog

Link to comment
Share on other sites

I know you mentioned only registered customers used the new function but was confused by the fact you wanted to edit the orders class. it is an easy fix, I need to update my PWA though, thought I had the newest 2.0a version for 2.2rc2a. installed, since I wrote an update guide. But alas, I have an older version installed....hmmm. Give me a couple of hours to complete some more important stuff and write the update. There is an array that is created by PWA:$order->pwa_label_shipping that should give us the info we need.

 

lildog

 

I have PWA 1.0.1 installed

Link to comment
Share on other sites

Pixclinic

 

Here is the PWA compatibility fix: this works for 1.2.5 and hopefully also 1.0.1, if not let me know. This will not work for PWA2.0....yet. Could you test this with a couple of test addresses and tell if if this works, if it does I will post and update to the contribs page.

 

REPLACE THE parse_DOR function in catalog/includes/functions/general.php

 

//BOF WA State Tax Modification

function parse_DOR(){ //Lookup WA State Sales tax from WA Department of Revenue website

global $customer_zone_id, $customer_country_id, $billto, $sendto, $cart, $customer_id;

 

//get customer's address is available

if ($customers_id == 0) { // if this is a PWA account

global $order;

if ($address_id == 1) {

$tax_address_raw = $order->pwa_label_shipping;

}else{

$tax_address_raw = $order->pwa_label_customer;

}

}else{ // this is an customer with an account

$tax_address_query = tep_db_query("select ab.entry_street_address, ab.entry_city, ab.entry_postcode from " . TABLE_ADDRESS_BOOK . " ab

left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)

where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)(($cart->content_type == 'virtual' ) ? $billto : $sendto) . "'");

}

 

 

if (tep_db_num_rows($tax_address_query) || ($tax_address_raw)) {

//we have some address information for this customer, so find their tax rate

 

if ($customers_id == 0) { // if this is a PWA account

$tax_address['entry_street_address']=$tax_address_raw['street_address'];

$tax_address['entry_city']=$tax_address_raw['city'];

$tax_address['entry_postcode']=$tax_address_raw['postcode'];

}else{

$tax_address = tep_db_fetch_array($tax_address_query);

}

 

$url .= "&addr=".urlencode($tax_address['entry_street_address']);

$url .= "&city=".urlencode($tax_address['entry_city']);

$url .= "&zip=".urlencode($tax_address['entry_postcode']);

 

$resultString = '';

// Start a cURL session and get the data

if($handle = curl_init($url)){

curl_setopt($handle,CURLOPT_RETURNTRANSFER,1);

curl_setopt($handle, CURLOPT_HEADER, 0);

curl_setopt($handle, CURLOPT_FORBID_REUSE, 1);

curl_setopt($handle, CURLOPT_FRESH_CONNECT, 1);

if($resultString = curl_exec($handle))curl_close($handle);

}

 

if (!empty($resultString)) {

$results = explode(' ', $resultString);

foreach ($results as $key=>$value) {

$breakPosition = strpos($value,"=");

$newKey = substr($value,0,$breakPosition);

$newValue = substr($value,$breakPosition+1);

$results[$newKey] = $newValue;

}

if ((int)$results['ResultCode'] < 3) return $results['Rate']*100;

}else{

// $resultString is empty

}

//we did not return a tax rate

}

// the address was not available use the stores tax rate?

}

//EOF WA State Tax Modification

 

 

lildog

Link to comment
Share on other sites

Will this work with the very first version of PWA 0.52 ? I would like to use this on cre loaded and it has PWA 0.52 installed. BTW thanks for a great mod.

 

Also, shouldn't the code above have the URL for WA DOR where it gets the tax rates from?

Link to comment
Share on other sites

Thanks I will try it right away

 

I get a:

 

Warning</b>: mysql_num_rows(): supplied argument is not a valid MySQL result resource in <b>/usr/home/web/users/a0020903/html/includes/functions/database.php</b> on line <b>107</b><br />

<br />

Link to comment
Share on other sites

Your variables are different than mine...

 

try: in the parse_DOR function in general.php

 

**FIND***

if ($address_id == 1) {

$tax_address_raw = $order->pwa_label_shipping;

}else{

$tax_address_raw = $order->pwa_label_customer;

}

 

replace with:

 

$tax_address_raw = $order->pwa_label;

Link to comment
Share on other sites

lildog and all the others who have worked so hard on this module, thank you very much. I do have what I hope to be a simple question though. On the contrib link you have the following:

The admin portion allows the store owner to upload address and rate databases supplied by the Washington State Department of Revenue for use in determining the sales tax rate from given street address and zip code.

Is that statement still applicable? If so, I can't find where this would be done at.

 

Thank you for your time.

Link to comment
Share on other sites

This does not apply to version 2.x of this contrib. This contrib now directly contacts the DOR web api.

lildog

 

lildog and all the others who have worked so hard on this module, thank you very much. I do have what I hope to be a simple question though. On the contrib link you have the following:

 

Is that statement still applicable? If so, I can't find where this would be done at.

 

Thank you for your time.

Link to comment
Share on other sites

I guess we need to contact the appropriate parties and see if we can get that changed.

 

lildog

 

I got your PM Todd and am working to have the contrib owner changed and/or the description changed to reflect the newest functionality.

 

Thanks to all whom have taken my beginnings and ran to the finish line with it! May this generosity come back to you ten fold!

 

Anyone seen the movie "Pay it Forward?" hehehe

 

Keith

Link to comment
Share on other sites

Hello - I just installed this and for some reason it is printing FL TAX 7.0% instead of WA tax. Does anyone know why this may be? Do I need to adjust some local settings in the admin (though none say Florida that I can see...). Thanks !

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...