Forums / Addon Order Total Modules / Customer Tax Exempt v2 - Support Thread

Customer Tax Exempt v2 - Support Thread

Views: 27,809

Results 1 to 20 of 28
4 Sep 2019, 1:05 PM
#1
swguy avatar

swguy

Administrator

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

Customer Tax Exempt v2 - Support Thread

The updated Customer Tax Exempt v2 for Zen Cart 1.5.6 is available here:
https://www.zen-cart.com/downloads.php?do=file&id=2259

Pre 1.5.6 Users can use:
https://www.zen-cart.com/downloads.php?do=file&id=405

Please use this thread for questions about the newer mod.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

23 Oct 2019, 12:07 AM
#2
dvtalk avatar

dvtalk

New Zenner

Join Date:
Mar 2018
Location:
USA
Posts:
30
Plugin Contributions:
0

Re: Customer Tax Exempt v2 - Support Thread

What is the reason why this couldn't work on v1.5.5x?

13 Nov 2019, 5:39 PM
#3
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

Re: Customer Tax Exempt v2 - Support Thread

I'm running ZC 1.5.6c and have installed this module.
When trying to use "Place Order" for a customer, if their account is set as tax exempt, then no products are showing. I see all the categories correctly.
If I delete "ALL" from the tax exempt field in customer account via admin, the products all show correctly.

Any suggestions as to why this might be happening?

Zen Cart developer since 2009 — Zen Cart Solutions
Ecommerce development, integrations & automation — Junction Solutions

6 May 2020, 7:22 PM
#4
ken_cefaratti avatar

ken_cefaratti

New Zenner

Join Date:
Mar 2020
Location:
Ohio USA
Posts:
3
Plugin Contributions:
0

Re: Customer Tax Exempt v2 - Support Thread

Does anyone know how to make this plugin work? I've installed the files per the instructions, but nothing shows up on how to mark a customer taxempt or to configure it. I'm using 1.5.6c

Sincerely,

Ken

8 Oct 2020, 5:29 PM
#5
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

dvtalk:

What is the reason why this couldn't work on v1.5.5x?

You need a bunch of notifiers from 1.5.6. Also the way the admin/customers form is built in 1.5.6 is different. You can backport it but it's a bunch of work that's probably better invested in upgrading at this point.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

8 Oct 2020, 5:33 PM
#6
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

Ken Cefaratti:

Does anyone know how to make this plugin work? I've installed the files per the instructions, but nothing shows up on how to mark a customer taxempt or to configure it. I'm using 1.5.6c

I have only used it to turn off all taxes, and it works great.

If you put "ALL" (no quotes) in the new field "Customer Tax Exempt" which is created on the Admin > Customers > Customers page, and the taxes are no longer charged for this customer.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

13 Apr 2021, 12:13 PM
#7
kernheimer avatar

kernheimer

Zen Follower

Join Date:
Jul 2009
Posts:
126
Plugin Contributions:
0

Re: Customer Tax Exempt v2 - Support Thread

Is this ( just installing a new shop, hence the question) safe to use under the new 1.5.7c?

29 Apr 2021, 1:37 PM
#8
lat9 avatar

lat9

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

I've just submitted v2.0.1 of Customers Tax-Exempt v2 for the Zen Cart moderators' review and will post back here when it's available for download.

 This release contains changes associated with the following GitHub issues:

#1: Correct MySQL error when customer has multiple tax-exemptions.
#2: Guest customers cannot be tax-exempt.

29 Apr 2021, 6:42 PM
#9
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

Thanks Cindy. Approved.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

17 May 2021, 7:13 PM
#10
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

The Sales Report plugin (https://www.zen-cart.com/downloads.php?do=file&id=9) simply calls zen_calculate_tax() to determine the tax on an item. Does this plugin correctly handle tax exempt customers? (It looks like no but I wasn't certain.)

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

17 May 2021, 7:47 PM
#11
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

Note: It could be that the correct fix for this issue (Sales Report shows sales tax on non-taxable orders) is a modification to Sales Report and not to this plugin.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Sep 2021, 11:17 PM
#12
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

It seems that when a newer MySQL database is in strict mode, the tax query on there's a bug in the tax query in TaxExemptCustomerObserver.php:258 can cause a fatal error:

[02-Sep-2021 18:35:54 America/New_York] Request URI: /store/index.php?main_page=shopping_cart, IP address: ::1
#1 trigger_error() called at [/Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php:170]
#2 queryFactory->show_error() called at [/Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php:142]
#3 queryFactory->set_error() called at [/Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php:269]
#4 queryFactory->Execute() called at [/Users/scott/Sites/store/includes/classes/observers/TaxExemptCustomerObserver.php:258]
#5 TaxExemptCustomerObserver->getCustomersTaxRatesSummed() called at [/Users/scott/Sites/store/includes/classes/observers/TaxExemptCustomerObserver.php:74]
#6 TaxExemptCustomerObserver->update() called at [/Users/scott/Sites/store/includes/classes/class.base.php:118]
#7 base->notify() called at [/Users/scott/Sites/store/includes/functions/functions_taxes.php:21]
#8 zen_get_tax_rate() called at [/Users/scott/Sites/store/includes/classes/shopping_cart.php:627]
#9 shoppingCart->calculate() called at [/Users/scott/Sites/store/includes/classes/shopping_cart.php:1385]
#10 shoppingCart->show_weight() called at [/Users/scott/Sites/store/includes/modules/pages/shopping_cart/header_php.php:30]
#11 require(/Users/scott/Sites/store/includes/modules/pages/shopping_cart/header_php.php) called at [/Users/scott/Sites/store/index.php:35]
--> PHP Fatal error: 1055:Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'store.tr.tax_description' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by :: SELECT SUM(tax_rate) AS tax_rate_summed, tax_description, tax_priority
FROM tax_rates tr
LEFT JOIN zones_to_geo_zones za
ON tr.tax_zone_id = za.geo_zone_id
LEFT JOIN geo_zones tz
ON tz.geo_zone_id = tr.tax_zone_id
WHERE tr.tax_class_id = 1
AND tr.tax_description NOT IN ('California Sales Tax')
AND (za.zone_country_id IS NULL OR za.zone_country_id = 0 OR za.zone_country_id = 223)
AND (za.zone_id IS NULL OR za.zone_id = 0 OR za.zone_id = 12)
GROUP BY tr.tax_priority
ORDER BY tr.tax_priority ==> (as called by) /Users/scott/Sites/store/includes/classes/observers/TaxExemptCustomerObserver.php on line 258 <== in /Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php on line 170.

A temporary workaround for this issue is to change the mysql_mode but it would be good if we could refactor this query.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

3 Sep 2021, 1:01 PM
#13
lat9 avatar

lat9

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

swguy:

It seems that when a newer MySQL database is in strict mode, the tax query on there's a bug in the tax query in TaxExemptCustomerObserver.php:258 can cause a fatal error:

[02-Sep-2021 18:35:54 America/New_York] Request URI: /store/index.php?main_page=shopping_cart, IP address: ::1
#1 trigger_error() called at [/Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php:170]
#2 queryFactory->show_error() called at [/Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php:142]
#3 queryFactory->set_error() called at [/Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php:269]
#4 queryFactory->Execute() called at [/Users/scott/Sites/store/includes/classes/observers/TaxExemptCustomerObserver.php:258]
#5 TaxExemptCustomerObserver->getCustomersTaxRatesSummed() called at [/Users/scott/Sites/store/includes/classes/observers/TaxExemptCustomerObserver.php:74]
#6 TaxExemptCustomerObserver->update() called at [/Users/scott/Sites/store/includes/classes/class.base.php:118]
#7 base->notify() called at [/Users/scott/Sites/store/includes/functions/functions_taxes.php:21]
#8 zen_get_tax_rate() called at [/Users/scott/Sites/store/includes/classes/shopping_cart.php:627]
#9 shoppingCart->calculate() called at [/Users/scott/Sites/store/includes/classes/shopping_cart.php:1385]
#10 shoppingCart->show_weight() called at [/Users/scott/Sites/store/includes/modules/pages/shopping_cart/header_php.php:30]
#11 require(/Users/scott/Sites/store/includes/modules/pages/shopping_cart/header_php.php) called at [/Users/scott/Sites/store/index.php:35]
--> PHP Fatal error: 1055:Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'store.tr.tax_description' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by :: SELECT SUM(tax_rate) AS tax_rate_summed, tax_description, tax_priority
FROM tax_rates tr
LEFT JOIN zones_to_geo_zones za
ON tr.tax_zone_id = za.geo_zone_id
LEFT JOIN geo_zones tz
ON tz.geo_zone_id = tr.tax_zone_id
WHERE tr.tax_class_id = 1
AND tr.tax_description NOT IN ('California Sales Tax')
AND (za.zone_country_id IS NULL OR za.zone_country_id = 0 OR za.zone_country_id = 223)
AND (za.zone_id IS NULL OR za.zone_id = 0 OR za.zone_id = 12)
GROUP BY tr.tax_priority
ORDER BY tr.tax_priority ==> (as called by) /Users/scott/Sites/store/includes/classes/observers/TaxExemptCustomerObserver.php on line 258 <== in /Users/scott/Sites/store/includes/classes/db/mysql/query_factory.php on line 170.

A temporary workaround for this issue is to change the mysql_mode but it would be good if we could refactor this query.
Does the following change correct the issue?

    
    protected function getCustomersTaxRatesSummed($tax_class_id, $country_id, $zone_id)
    {
        $tax_class_id = (int)$tax_class_id;
        if ($country_id == -1 && $zone_id == -1) {
            $country_id = $_SESSION['customer_country_id'];
            $zone_id = $_SESSION['customer_zone_id'];
        }
        $country_id = (int)$country_id;
        $zone_id = (int)$zone_id;

        $tax_info = $GLOBALS['db']->Execute(
            "SELECT SUM(tax_rate) AS tax_rate_summed, tax_description, tax_priority
              FROM " . TABLE_TAX_RATES . " tr
                    LEFT JOIN " . TABLE_ZONES_TO_GEO_ZONES . " za 
                        ON tr.tax_zone_id = za.geo_zone_id
                    LEFT JOIN " . TABLE_GEO_ZONES . " tz 
                        ON tz.geo_zone_id = tr.tax_zone_id
              WHERE tr.tax_class_id = $tax_class_id
                AND tr.tax_description NOT IN ({$this->exemptions_list})
                AND (za.zone_country_id IS NULL OR za.zone_country_id = 0 OR za.zone_country_id = $country_id)
                AND (za.zone_id IS NULL OR za.zone_id = 0 OR za.zone_id = $zone_id)
              GROUP BY tr.tax_priority[B], tr.tax_description[/B]
              ORDER BY tr.tax_priority"
        );
        return $tax_info;
    }
4 Oct 2021, 11:40 AM
#14
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

This seems like a good fix.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

4 Oct 2021, 11:50 AM
#15
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

Note that the Customer Tax Exempt field will not show up in Admin > Customers > Customers unless Admin > Configuration > Customer Details > Company is set to true. This is probably not the desired behavior.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

12 Apr 2024, 12:40 PM
#16
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

Seems like the case NOTIFY_ADMIN_CUSTOMERS_CUSTOMER_EDIT in admin/includes/classes/observers/CustomerTaxExemptAdminObserver.php also needs to return fieldname or you get

--> PHP Warning: Undefined array key "fieldname" in /Users/scott/sites/client/admin/customers.php on line 704.

in newer versions of PHP.

Change

                    'label' => ENTRY_TAX_EXEMPT,

to

                    'label' => ENTRY_TAX_EXEMPT,
                    'fieldname' => 'customers_tax_exempt',

on line 80 of admin/includes/classes/observers/CustomerTaxExemptAdminObserver.php

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

12 Apr 2024, 3:00 PM
#17
lat9 avatar

lat9

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

swguy:

Note that the Customer Tax Exempt field will not show up in Admin > Customers > Customers unless Admin > Configuration > Customer Details > Company is set to true. This is probably not the desired behavior.
Doesn't a tax-exemption need to be associated with a company?

12 Apr 2024, 3:03 PM
#18
lat9 avatar

lat9

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

swguy:

Seems like the case NOTIFY_ADMIN_CUSTOMERS_CUSTOMER_EDIT in admin/includes/classes/observers/CustomerTaxExemptAdminObserver.php also needs to return fieldname or you get

--> PHP Warning: Undefined array key "fieldname" in /Users/scott/sites/client/admin/customers.php on line 704.

in newer versions of PHP.

Change

                    'label' => ENTRY_TAX_EXEMPT,

to

                    'label' => ENTRY_TAX_EXEMPT,
                    'fieldname' => 'customers_tax_exempt',

on line 80 of admin/includes/classes/observers/CustomerTaxExemptAdminObserver.php
GitHub issue created: https://github.com/lat9/customer_tax_exempt_2/issues/5

25 Apr 2024, 4:32 PM
#19
lat9 avatar

lat9

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

v2.0.2 of Customer Tax-Exempt is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2259

This release contains corrections for the following GitHub issues:

#3: Correcting storefront query for MySQL 5.7 and later
#5: Correct undefined-array-key log during admin processing
#6: Correct PHP log when editing a customer with no previous tax-exemptions.

25 Apr 2024, 4:44 PM
#20
swguy avatar

swguy

Administrator

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

Re: Customer Tax Exempt v2 - Support Thread

Great stuff! A very valuable addition to Zen Cart.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.