Easy Populate bug for new EU tax zones set up.

Open to all! Ask other shopowners for help.
Post Reply
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply