fburn Posted August 25, 2008 Share Posted August 25, 2008 I'm having an issue with modifying version 1.0 to use US destination based sales and use taxes. Background: currently the following US states require the calculation of sales tax based on the destination a product is shipped to. ArkansasIndianaIowaKansasKentuckyMichiganMinnesotaNebraskaNevadaNew JerseyNorth CarolinaNorth DakotaOklahomaRhode IslandSouth DakotaVermontWashingtonWest VirginiaWyomingThe specific tax includes both a state rate and a local rate for a composite tax that can vary dramatically throughout a state depending on the address. I am currently implementing a destination tax for Washington state. The washington state department of revenue has been kind enough to provide an xml interface for a tax look-up. The following is the code I use to execute that query: $address = new Address(intval($cart->id_address_delivery)); $params = array( 'output' => urlencode('xml'), 'addr' => urlencode($address->address1), 'city' => urlencode($address->city), 'zip' => urlencode($address->postcode), ); $query = 'http://dor.wa.gov/AddressRates.aspx?' . http_build_query($params); // send the query and parse the reply into xml $c = curl_init($url); curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($c); $content = curl_multi_getcontent($c); curl_close($c); $_xml = simplexml_load_string($content); return floatval($_xml->rate['staterate']) + floatval($_xml->rate['localrate']); In the Tax object I have added a check to determine if the state_id == washington within getApplicableTax(). If it does, it should execute the code above and return the appropriate tax rate. Unfortunately, it works in isolation, but not within the context of the prestashop application. I've backtracked through the files to locate all instances where getApplicableTax is called and it appears to be Product.php and PaymentModule.php. Is there something I'm missing in either of these classes, or somewhere else that could account for why the tax fails to calculate?Any insight would be immensely appreciated.Finnian Burn Link to comment Share on other sites More sharing options...
insideout Posted August 27, 2008 Share Posted August 27, 2008 I'm also hoping to implement Washington destination tax in prestashop. Anyone have feedback for us on this issue? Link to comment Share on other sites More sharing options...
fburn Posted August 27, 2008 Author Share Posted August 27, 2008 insideout,I would be happy to collaborate with you on implementing this. Have you already started? Do you another method in mind?Finnian Burn Link to comment Share on other sites More sharing options...
fburn Posted August 27, 2008 Author Share Posted August 27, 2008 Another thing,Because the destination tax has been in effect since July 1st, I'm currently using a workaround with a 9% sales tax and refunding the difference. Not exactly the most ideal solution, but it will work until a complete fix is done.Finnian Burn Link to comment Share on other sites More sharing options...
insideout Posted August 27, 2008 Share Posted August 27, 2008 I haven't really gotten started on it. Just been working with PrestaShop for a week now.Unfortunately, I also have ZenCart and Virtuemart customers in the same boat.I'll have to see how much money/time my customer wants to put in this direction. But I'd be happy to test anything you have put together. Link to comment Share on other sites More sharing options...
Recommended Posts