Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default 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 Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  2. #12
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default 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 Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  3. #13
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    10,637
    Plugin Contributions
    78

    Default Re: Customer Tax Exempt v2 - Support Thread

    Quote Originally Posted by swguy View Post
    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;
        }

  4. #14
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default Re: Customer Tax Exempt v2 - Support Thread

    This seems like a good fix.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  5. #15
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,990
    Plugin Contributions
    109

    Default 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 Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v150 Tax Exempt by Customer Group
    By lunabug in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 9 Jul 2012, 07:25 AM
  2. Tax Exempt by Customer Group
    By TecBrat in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 20 Sep 2009, 03:14 AM
  3. Customer Tax Exempt
    By numinix in forum All Other Contributions/Addons
    Replies: 46
    Last Post: 5 Jan 2009, 03:11 PM
  4. Making a customer tax exempt
    By fontuna in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 38
    Last Post: 24 Jul 2007, 09:08 PM
  5. Configuring Taxes to support certain tax-exempt customers
    By scully2569 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 6
    Last Post: 26 Mar 2007, 02:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR