Easy Populate bug for new EU tax zones set up.

Ask the community for help and support.
Post Reply
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Easy Populate bug for new EU tax zones set up.

Post by raiwa »

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:

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");
should be extended to filter for the store zone:

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");
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.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
Post Reply