Easy Populate bug for new EU tax zones set up.
Posted: Sat Jul 17, 2021 5:53 pm
I found a bug in easy populate regarding tax calculation. It affects tax setup for new EU tax regulation if different tax rates are setup by tax zones for the same tax id. I believe it will only be noticeable if you upload prices including tax.
In admin/functions/easypopulate_functions.php the tax query line 64:
should be extended to filter for the store zone:
I discovered this in a store where the new EU tax legislation has been applied which requires to charge different tax rates for each country in European Union since this month.
The original query applied the sum of all tax rates with the product tax class ID ignoring the zone.
It's supposed that the user will upload prices with the tax rate of the store country and zone. So using STORE_COUNTRY and STORE_ZONE should do the trick.
In admin/functions/easypopulate_functions.php the tax query line 64:
Code: Select all
$tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " WHERE tax_class_id = '" . $tax_class_id . "' GROUP BY tax_priority");
Code: Select all
$tax_query = tep_db_query("select SUM(tax_rate) as tax_rate 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 (za.zone_country_id IS NULL OR za.zone_country_id = '0' OR za.zone_country_id = '" . (int)STORE_COUNTRY . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . (int)STORE_ZONE . "') AND tr.tax_class_id = '" . (int)$tax_class_id . "' GROUP BY tr.tax_priority");
The original query applied the sum of all tax rates with the product tax class ID ignoring the zone.
It's supposed that the user will upload prices with the tax rate of the store country and zone. So using STORE_COUNTRY and STORE_ZONE should do the trick.