Zen Cart Logo
Forums / Currencies & Sales Taxes, VAT, GST, etc. / Local Sales Tax Mod - Support Thread

Local Sales Tax Mod - Support Thread

Views: 273,272

Results 621 to 640 of 659
09 Apr 2021, 01:57
#621
brian70809 avatar

brian70809

New Zenner

Join Date:
Jun 2011
Posts:
85
Plugin Contributions:
0

Local Sales Tax Mod - Support Thread

I love this mod and have used it for the last 2 years. I know that this has never been addressed due to how it calculates Tax. It's not doing it per item it just has a function that totals the order and kicks it out.

I need to be able to put the taxed item each into invoicing for billing purposes and I'm manually doing it now through an export and it's tedious. I did what they said to do by just removing the columns, but that just hides the problem.

Has anyone solved this problem?

Thanks!

30 Jun 2021, 19:18
#622
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

LadyHLG:

Tesla,
I haven't had time to test this, but you can give it a try.
Open the following file:
includes\modules\order_total\ot_local_sales_taxes.php

at about line 170 look for the following:
$debug2 .= $myfield."<br>";

right above that line place the following code:

if($taxmatch == "postcode"){
$myfield = substr($myfield, 0, 5);
}

> 
> See if it does the trick.
> 
> LadyHLG

I have the exact same issue now. If the customer uses 9-digit zipcode, his order will be "tax free". Plug-in version 2.5.3a. "$debug2" or "$myfield" are not existed any more. Here is how I changed my code, which is similar to the guide above. 

At around line 86. Change the following code in includes\modules\order_total\ot_local_sales_taxes.php

$apply_local_tax = check_for_datamach($taxrec['order_data'], $taxrec['matching_data']);


To the following

$apply_local_tax = check_for_datamach(substr($taxrec['order_data'], 0, 5), $taxrec['matching_data']);


I tried it on my end (zc 1.57c, php7.4) and it seems to work good.

Keywords for search: 9-digit, 9 digits, nine digits
25 Jan 2022, 15:52
#623
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

Updated to fix various issues with newer PHP/Zen Cart.

26 Jan 2022, 21:26
#624
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

swguy:

Updated to fix various issues with newer PHP/Zen Cart.

Hi Swguy, thanks for updating this plug-in. May I know if any tips to update this plug-in from 2.5.3b to 2.6?

03 Feb 2022, 19:29
#625
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

Hi Swguy, I tested this plug-in on my test site, and I noticed that the previous two issues are not fixed.

One is the 9-digit zipcode issue. Once the customer entered 9-digit zipcode instead of 5 digit, his order will be "tax free". The fix is similar to my previous post.

Another is the tax rate for the store pickup. By test, if the customer selected store pickup option, the tax rate was charged by the zipcode in his shipping address, not the zipcode of my store. For pickup order, the tax should be charged by the zipcode of the store location, not by the shipping address.

03 Feb 2022, 21:00
#626
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

Yep I just fixed PHP issues.

20 Mar 2022, 11:38
#627
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

includes/modules/order_total/ot_local_sales_taxes.php line 43 (checking payment type = "quest") was an accidental inclusion that should be removed.

11 Apr 2022, 19:55
#628
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

Hi Swguy. Can you please explain the "accidental inclusion" in details? Here is the line 43:

if (!empty($_SESSION['payment']) && $_SESSION['payment']  === 'quest') return []; 

Do you mean change it to the following?

if (!empty($_SESSION['payment']) && $_SESSION['payment']  === 'quest') return; 
11 Apr 2022, 21:14
#629
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

Just delete that whole line - unless you are a vendor in Alaska who takes Quest as a payment method, and does not need to charge sales tax for Quest-paid orders. :)

13 Apr 2022, 19:38
#630
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

That is easy. Thanks!

10 Jun 2022, 20:37
#631
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

It seems this plug-in (v2.6) doesn't work well with the zc group pricing (zc 1.57d). The tax rate is calculated based on the sub-total rate (before the group discount). The discount amount by group pricing is not used to calculate the tax. In the settings of my group discount, I set "Re-calculate Tax" option as standard, so the tax should be based on the sub-total minus discount amount.

I tried to set this option as "none" or "credit note", the result is unchanged. So it looks like no matter which option I set, it will be treated as "none".

This bug is not critical but hopefully it can be fixed later.

10 Jun 2022, 21:40
#632
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

If you look at includes/modules/order_total/ot_local_sales_taxes.php line 129-139 - the block that starts with

              if ($apply_tax_to_shipping) {

You could use some similar logic to back out the tax on the group discount amount.

13 Jun 2022, 19:59
#633
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

Hi Swguy,

Thanks for your tip. I added the following code below your mentioned "if ($apply_tax_to_shipping)" section, and now it shows the correct group discount amount (calculated based on the total minus group discount). I don't think this way is proper but I don't know how to get the discount amount from the group pricing php file. I don't know if there is a public parameter for the group discount which I can use in this tax php file.

          $tax_total_for_class_group_discount = '';              
          $tax_total_for_class_group_discount = zen_calculate_tax (($order->info['total'] - $order->info['tax'] - $order->info['shipping_cost']), $taxrec['tax']);
          $tax_total_for_class = $tax_total_for_class_group_discount;

Also, now the total amount (last line of the checkout page) is incorrect/unchanged. How can I update the total amount?

13 Jun 2022, 20:25
#634
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

Ok. The following code fixed the incorrect total amount issue. Still, I'm not sure if it is the proper way...

              $tax_total_for_class_group_discount = '';  
              $tax_total_diff = '';           
              $tax_total_for_class_group_discount = zen_calculate_tax (($order->info['total'] - $order->info['tax'] - $order->info['shipping_cost']), $taxrec['tax']);
              $tax_total_diff = $tax_total_for_class - $tax_total_for_class_group_discount;
              if($tax_total_diff > 0) {
              $order->info['total'] -= $tax_total_diff;
              $tax_total_for_class = $tax_total_for_class_group_discount;
           }       
08 Dec 2023, 17:59
#635
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
942
Plugin Contributions:
3

Re: Local Sales Tax Mod - Support Thread

Found that I was getting thrown Fatal errors on ZC 1.5.8/PHP 8.2 when trying to edit a tax rate in the backend. (When you would insert a row and click edit, you would not get the edit form and would generate a bunch of PHP errors in the log directory.) I made the following changes to get it to work:

  1. Open YOUR_ADMIN/local_sales_taxes.php.
  2. Edit line 255. Find php zen_get_countries(TEXT_ALL_COUNTRIES) and replace with: ```php
    zen_get_countries_for_admin_pulldown()
3. Edit line 272. Find ```php
zen_get_countries(TEXT_ALL_COUNTRIES)
``` and replace with: ```php
zen_get_countries_for_admin_pulldown()
```.

This should fix the error in 1.5.8a.
06 Dec 2024, 23:28
#636
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
942
Plugin Contributions:
3

Re: Local Sales Tax Mod - Support Thread

Looking for help.

Running the module, as is, running into two problems.

First, the module is adding the result local sales tax twice. I configured it for New York City which is New York State's 4% Sales Tax + NYC's 4.875%. Which totals 8.875%.

However, running an order through: The total tax being calculated is: The "state" sales tax of 4% + The City Tax of 4.875% + The City Tax of 4.875%. I went through and made sure the entry for the City was only entered once. But I cannot see where to stop the tax is being calculated twice.

Additionally, when the order is ran against a payment module: say PayPal, Stripe, Square, etc., the local sales tax module is completely bypassed and ignored.

Debugging the cart, I can see the per item tax is being calculated as 13.75% (aka 4% + 4.875% + 4.875%) and that the tax description is "State Tax + County Tax + County Tax".

Looking for any assistance on the matter.

EDIT: Seems this is kind of a known issue of sorts (https://www.zen-cart.com/showthread.php?206979-Tax-getting-added-twice-after-installing-Local-Sales-Tax-mod)

09 Dec 2024, 21:03
#637
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
362
Plugin Contributions:
0

Re: Local Sales Tax Mod - Support Thread

retched:

Looking for help.

Running the module, as is, running into two problems.

First, the module is adding the result local sales tax twice. I configured it for New York City which is New York State's 4% Sales Tax + NYC's 4.875%. Which totals 8.875%.

However, running an order through: The total tax being calculated is: The "state" sales tax of 4% + The City Tax of 4.875% + The City Tax of 4.875%. I went through and made sure the entry for the City was only entered once. But I cannot see where to stop the tax is being calculated twice.

Additionally, when the order is ran against a payment module: say PayPal, Stripe, Square, etc., the local sales tax module is completely bypassed and ignored.

Debugging the cart, I can see the per item tax is being calculated as 13.75% (aka 4% + 4.875% + 4.875%) and that the tax description is "State Tax + County Tax + County Tax".

Looking for any assistance on the matter.

EDIT: Seems this is kind of a known issue of sorts (https://www.zen-cart.com/showthread.php?206979-Tax-getting-added-twice-after-installing-Local-Sales-Tax-mod)

Just my 2C.

When I installed this plug-in, I disabled the original tax rate for my state, which is under locations/taxes - Tax Rates. I set the tax rate there to 0. I didn't delete it there. Then I only use local sales tax to calculate the total tax rate for every zipcode.

I'm not sure, if I didn't disable the zc tax rate, will it be double counted or not.

For your 2nd question, I'm using paypal legacy module. So on paypal end, it cannot see how much tax was charged for every order. But the total order amount is correct (goods+shipping+tax). In the past before I installed this plug-in, I can see a separate row in paypal transaction showing the tax.

But for other places such as order confirmation email or zc back end order details, I can see a separate row for the sales tax.

10 Dec 2024, 05:16
#638
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
942
Plugin Contributions:
3

Re: Local Sales Tax Mod - Support Thread

njcyx:

Just my 2C.

When I installed this plug-in, I disabled the original tax rate for my state, which is under locations/taxes - Tax Rates. I set the tax rate there to 0. I didn't delete it there. Then I only use local sales tax to calculate the total tax rate for every zipcode.

I'm not sure, if I didn't disable the zc tax rate, will it be double counted or not.

For your 2nd question, I'm using paypal legacy module. So on paypal end, it cannot see how much tax was charged for every order. But the total order amount is correct (goods+shipping+tax). In the past before I installed this plug-in, I can see a separate row in paypal transaction showing the tax.

But for other places such as order confirmation email or zc back end order details, I can see a separate row for the sales tax.

Actually managed to get it to work with the Squash Taxes module (they should just be combined at this point). I'm working on submitting my changes to both shortly. Still don't see why it was being added twice.

02 Jan 2025, 17:47
#639
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

Still don't see why it was being added twice.
I have seen the same issue. The order line items all look good, but the entry in orders_products.products_tax is doubled, as you note.

12 Mar 2025, 14:55
#640
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Local Sales Tax Mod - Support Thread

v3.0.0 of Local Sales Tax is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=422

Released as a Zen Cart encapsulated plugin, supporting zc210+, EO 5.0.0+ and PHP 8.0+.