-
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.
-
Re: Customer Tax Exempt v2 - Support Thread
What is the reason why this couldn't work on v1.5.5x?
-
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?
-
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
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
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.
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
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.
-
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?
-
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.
-
Re: Customer Tax Exempt v2 - Support Thread
-
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.)
-
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.
-
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.
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
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?
Code:
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, tr.tax_description
ORDER BY tr.tax_priority"
);
return $tax_info;
}
-
Re: Customer Tax Exempt v2 - Support Thread
This seems like a good fix.
-
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.
-
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
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
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?
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
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
-
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.
-
Re: Customer Tax Exempt v2 - Support Thread
Great stuff! A very valuable addition to Zen Cart.
-
Re: Customer Tax Exempt v2 - Support Thread
ZC 2.1
PHP 8.3
The SQL script does not run when I refresh the admin home page after uploading this plugin.
Consequently, I get a broken "Customers" Details page and an error log stating, "Unknown Column" 'customer tax exempt'.
Can I just manually add the field in 'customers'?
Any assistance would be greatly appreciated.
*****************************************
[01-Feb-2025 13:29:39 America/Boise] Request URI: //index.php?cmd=customers&page=1&cID=5018&action=edit, IP address: , Language id 1
#0 [internal function]: zen_debug_error_handler()
#1 /home2//includes/classes/db/mysql/query_factory.php(733): trigger_error()
#2 /home2//includes/classes/db/mysql/query_factory.php(678): queryFactory->show_error()
#3 /home2//includes/classes/db/mysql/query_factory.php(307): queryFactory->set_error()
#4 /home2//admin/includes/classes/observers/CustomerTaxExemptAdminObserver.php(64): queryFactory->Execute()
#5 /home2//includes/classes/traits/NotifierManager.php(106): CustomerTaxExemptAdminObserver->update()
#6 /home2//Zcf294AkrVd6csa550FeF/customers.php(711): base->notify()
#7 /home2//Zcf294AkrVd6csa550FeF/index.php(16): require('/home2/wildstee...')
--> PHP Fatal error: MySQL error 1054: Unknown column 'customers_tax_exempt' in 'field list' :: SELECT customers_tax_exempt
FROM customers
WHERE customers_id = 5018
LIMIT 1 ==> (as called by) //admin/includes/classes/observers/CustomerTaxExemptAdminObserver.php on line 64 <== in //public_html/includes/classes/db/mysql/query_factory.php on line 733.
-
Re: Customer Tax Exempt v2 - Support Thread
You need to add that field in your database for customers
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
jimmie
You need to add that field in your database for customers
Thank you for the reply.
I just don't know exactly how to set the entry up in the database.
-
Re: Customer Tax Exempt v2 - Support Thread
go to db customers, click structure add 1 column after
this is what i have there
customers_tax_exempt text utf8mb4_general_ci Yes NULL
-
Re: Customer Tax Exempt v2 - Support Thread
Quote:
Originally Posted by
jimmie
go to db customers, click structure add 1 column after
this is what i have there
customers_tax_exempt text utf8mb4_general_ci Yes NULL
Excellent, thank you very much for taking the time and helping.