| @@ 1251-1259 (lines=9) @@ | ||
| 1248 |   function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { | |
| 1249 | global $customer_zone_id, $customer_country_id; | |
| 1250 | ||
| 1251 |     if ( ($country_id == -1) && ($zone_id == -1) ) { | |
| 1252 |       if (!tep_session_is_registered('customer_id')) { | |
| 1253 | $country_id = STORE_COUNTRY; | |
| 1254 | $zone_id = STORE_ZONE; | |
| 1255 |       } else { | |
| 1256 | $country_id = $customer_country_id; | |
| 1257 | $zone_id = $customer_zone_id; | |
| 1258 | } | |
| 1259 | } | |
| 1260 | ||
| 1261 |     $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)$country_id . "') AND (za.zone_id IS NULL OR za.zone_id = '0' OR za.zone_id = '" . (int)$zone_id . "') AND tr.tax_class_id = '" . (int)$class_id . "' GROUP BY tr.tax_priority"); | |
| 1262 |     if (tep_db_num_rows($tax_query)) { | |
| @@ 329-337 (lines=9) @@ | ||
| 326 | global $customer_zone_id, $customer_country_id; | |
| 327 | static $tax_rates = array(); | |
| 328 | ||
| 329 |     if ( ($country_id == -1) && ($zone_id == -1) ) { | |
| 330 |       if (!tep_session_is_registered('customer_id')) { | |
| 331 | $country_id = STORE_COUNTRY; | |
| 332 | $zone_id = STORE_ZONE; | |
| 333 |       } else { | |
| 334 | $country_id = $customer_country_id; | |
| 335 | $zone_id = $customer_zone_id; | |
| 336 | } | |
| 337 | } | |
| 338 | ||
| 339 |     if (!isset($tax_rates[$class_id][$country_id][$zone_id]['rate'])) { | |
| 340 |       $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)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority"); | |