angrypeach Posted February 25, 2004 Posted February 25, 2004 I have installed the contribution City Tax Rate Hack for MS1 (installed it on MS2) and it seems to work fine. EXCEPT, it seems to be taxing based on the billing address when here in Denver, Colorado, taxes are to be charged according to the shipping address. It looks like a something that could relatively be easy to work around, this contribution is not complicated at all. However, I am not much of a coder and I am afraid to give this a shot. Here is the code in question................................................................ // Returns the tax rate for a zone / class // TABLES: tax_rates, zones_to_geo_zones function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { global $customer_zone_id, $customer_country_id, $customer_id; $customer_city_query = tep_db_query("select entry_city, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); $customer_city = tep_db_fetch_array($customer_city_query); $customer_city['entry_city'] = strtoupper($customer_city['entry_city']); if (($customer_city['entry_city'] == 'DENVER') && ($customer_city['entry_zone_id'] == 13)) { return 7.3000; // Input your custom tax rate here } // elseif (($customer_city['entry_city'] == 'DENVER') && ($customer_city['entry_zone_id'] == 13)) { // return 7.3000; // Uncomment these lines and input your 2nd custom tax rate here // } // elseif (($customer_city['entry_city'] == 'DENVER') && ($customer_city['entry_zone_id'] == 13)) { // return 7.3000; // Uncomment these lines and input your 3rd custom tax rate here // } elseif ( ($country_id == -1) && ($zone_id == -1) ) { if (!tep_session_is_registered('customer_id')) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } $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 = '" . $country_id . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . $zone_id . "') AND tr.tax_class_id = '" . $class_id . "' GROUP BY tr.tax_priority"); if (tep_db_num_rows($tax_query)) { $tax_multiplier = 0; while ($tax = tep_db_fetch_array($tax_query)) { $tax_multiplier += $tax['tax_rate']; } return $tax_multiplier; } else { return 0; } } //// // Return the tax description for a zone / class // TABLES: tax_rates; function tep_get_tax_description($class_id, $country_id, $zone_id) { global $customer_id; $customer_city_query = tep_db_query("select entry_city, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); $customer_city = tep_db_fetch_array($customer_city_query); $customer_city['entry_city'] = strtoupper($customer_city['entry_city']); $tax_query = tep_db_query("select tax_description 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 = '" . $country_id . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . $zone_id . "') AND tr.tax_class_id = '" . $class_id . "' order by tr.tax_priority"); if (($customer_city['entry_city'] == 'DENVER') && ($customer_city['entry_zone_id'] == 13)) { return TEXT_CUSTOM_TAX_RATE; // Input your custom tax description here } // elseif (($customer_city['entry_city'] == 'DENVER') && ($customer_city['entry_zone_id'] == 13)) { // return TEXT_CUSTOM_TAX_RATE2; // Uncomment these lines and input your custom tax description here // } // elseif (($customer_city['entry_city'] == 'DENVER') && ($customer_city['entry_zone_id'] == 13)) { // return TEXT_CUSTOM_TAX_RATE3; // Uncomment these lines and input your custom tax description here // } elseif (tep_db_num_rows($tax_query)) { $tax_description = ''; while ($tax = tep_db_fetch_array($tax_query)) { $tax_description .= $tax['tax_description'] . ' + '; } $tax_description = substr($tax_description, 0, -3); return $tax_description; } else { return TEXT_UNKNOWN_TAX_RATE; } } ........................................................ Thanks so much for any help if anyone can figure this out. TAXES, why do they always have to cause so much pain? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.