Web Tool Bag  
Home · Articles · Downloads · Discussion Forum · Web Links · News CategoriesFebruary 05 2012 10:14:04
Navigation
Home
Articles
Downloads
Discussion Forum
Web Links
News Categories
Search
Users Online
Guests Online: 5
No Members Online

Registered Members: 625
Newest Member: nownigcheencex43
Forum Threads
Newest Threads
reverse mortgage
Science channels in ...
How can I see the fu...
Order Flagyl Without...
X-Rumer 7.0 - best s...
Hottest Threads
Installation [11]
Hermoine nude [6]
Captcha picture d... [6]
Integrate with Vi... [5]
Any questions and... [5]
Trusted web hosting

Coupon Code
WEBTOOLBAG
Latest Articles
jQuery Accordion - m...
Few Guidelines for W...
Move OST to PST to U...
Microsoft OST vs. Mi...
Tips for Specialized...
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 zdravko on July 11 2008 08:43:58 1178 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

PHPDevShell

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

PHP Obfuscator
Copyright © 2012 - www.webtoolbag.com