Web Tool Bag  
Home · Articles · Downloads · Discussion Forum · Web Links · News Categories · Synonyms DatabaseMarch 29 2024 09:35:48
Navigation
Home
Articles
Downloads
Discussion Forum
Web Links
News Categories
Synonyms Database
Search
Users Online
Guests Online: 1
No Members Online

Registered Members: 856
Unactivated Members: 118
Newest Member: lakim
Forum Threads
Newest Threads
Error: Cannot find m...
Uncaught Error: _reg...
Module build failed:...
Installation
mochi script questions
Hottest Threads
Installation [12]
Any questions and... [5]
Captcha picture d... [4]
Integrate with Vi... [4]
Mods: Sucess/Than... [4]
 
Latest Articles
Ubuntu: the vpn conn...
Howto Install HP Pri...
ReactJS progress met...
react-show-more-text
react-collapsible-co...
City Tax Rates for OsCommerce
City Tax Rates for OsCommerce FIX

in catalog/includes/functions/general.php replace tep_get_tax_rate and tep_get_tax_description functions: (don't use functions in install.txt file, please use functions bellow)

function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
global $customer_zone_id, $customer_country_id, $customer_id;

//get customers info
//Zdr Patch
// Taxes are calculated by City Tax Rate according Billing Address
// If needed to be calculated according Shsipping address use $_SESSION['sendto'] is sql query
// $customer_city_query = tep_db_query("select entry_city, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");
$customer_city_query = tep_db_query("select entry_city, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . $_SESSION['billto'] . "'");

$customer_city = tep_db_fetch_array($customer_city_query);
$customer_city['entry_city'] = strtoupper($customer_city['entry_city']);

//set tax rate if city and zone id match
$customer_city_rate_query = tep_db_query("select CITY, RATE from citysalesrate where CITY = '" . $customer_city['entry_city'] . "'");

//Zdr Patch
// if (($customer_city_rate = tep_db_fetch_array($customer_city_rate_query)) && ($customer_zone_id == STORE_ZONE)) {

if ( $customer_city_rate = tep_db_fetch_array($customer_city_rate_query) ) {
return $customer_city_rate['RATE'];
}
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_zone_id;


//get customers info
//Zdr Patch
//Description is shown according Billing Address
// If needed to be shown according Shsipping address use $_SESSION['sendto'] is sql query
$customer_city_query = tep_db_query("select entry_city, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . $_SESSION['billto'] . "'");
$customer_city = tep_db_fetch_array($customer_city_query);
$customer_city['entry_city'] = strtoupper($customer_city['entry_city']);

//set tax description if city and zone id match
$customer_city_rate_query = tep_db_query("select CITY, RATE from citysalesrate where CITY = '" . $customer_city['entry_city'] . "'");
$customer_city_rate = tep_db_fetch_array($customer_city_rate_query);
$customer_city_rate['CITY'] = strtoupper($customer_city_rate['CITY']);


function descr_resultz(){

$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");

return tep_db_num_rows($tax_query);

}

//Zdr Patch
// if (($customer_city_rate['CITY'] == $customer_city['entry_city']) && ($customer_zone_id == STORE_ZONE)) {
if ( $customer_city_rate['CITY'] == strtoupper($customer_city['entry_city']) ) {
return $customer_city_rate['CITY'] . ' TAX ' . $customer_city_rate['RATE'] . '%';

}elseif (descr_resultz()) {

$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");
$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;
}
}

Posted by admin on July 11 2008 08:43:58 6106 Reads · Print
Ratings
Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Member Poll
Which PHP framework do you preffer?

Symfony

Zend

CodeIgniter

PHP on TRAX

eZ Components

Fusebox

PhpOpenbiz

Prado

QPHP

Seagull

You must login to vote.
Shoutbox
You must login to post a message.

Vince
03/10/2011 18:17
Hi, How to remove Register from Login screen? I don't want them to register and have full access! if you leave register then they should not have any rights until the admin assigns them

webtoolz
26/09/2011 08:28
Please describe your problem with more details. Thank you.

bimmer98
22/11/2010 18:31
Help. There was a problem with the request; error regarding feedbackzdr form program

Custom web software development by Devzone Tech
Copyright © 2024 - www.webtoolbag.com