Hi scully2569
I was not sure if anybody else needs this. I am not expert, but I managed to hack the code to my needs. Here is how I did it -
Please note that you need to have the "dual_pricing_1_3" module installed before making this change.
Open the file includes/functions/functions_taxes.php
Close to line 32, look for -
PHP Code:
$tax_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";
Replace it with -
PHP Code:
// KLUDGE START by Harmeet - To charge only GST from resellers.
if ($_SESSION['customer_id']) {
$customers_id = $_SESSION['customer_id'];
$customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'");
if ($customer_check->fields['customers_whole'] != "0") {
$whole = 1;
}
}
if ($whole) {
$tax_query = "select 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";
}
else {
// KLUDGE END
$tax_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";
// KLUDGE START by Harmeet - To charge only GST from resellers.
}
// KLUDGE END
Close to line 78, look for -
PHP Code:
if ($tax->RecordCount() > 0) {
$tax_description = '';
while (!$tax->EOF) {
$tax_description .= $tax->fields['tax_description'] . ' + ';
$tax->MoveNext();
}
$tax_description = substr($tax_description, 0, -3);
return $tax_description;
} else {
return TEXT_UNKNOWN_TAX_RATE;
}
Replace it with -
PHP Code:
// KLUDGE START by Harmeet - To charge only GST from resellers.
if ($_SESSION['customer_id']) {
$customers_id = $_SESSION['customer_id'];
$customer_check = $db->Execute("select * from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'");
if ($customer_check->fields['customers_whole'] != "0") {
$whole = 1;
}
}
if ($whole) {
if ($tax->RecordCount() > 0) {
$tax_description = $tax->fields['tax_description'] . ' + ';
$tax_description = substr($tax_description, 0, -3);
return $tax_description;
} else {
return TEXT_UNKNOWN_TAX_RATE;
}
}
else {
// KLUDGE END
if ($tax->RecordCount() > 0) {
$tax_description = '';
while (!$tax->EOF) {
$tax_description .= $tax->fields['tax_description'] . ' + ';
$tax->MoveNext();
}
$tax_description = substr($tax_description, 0, -3);
return $tax_description;
} else {
return TEXT_UNKNOWN_TAX_RATE;
}
// KLUDGE START by Harmeet - To charge only GST from resellers.
}
// KLUDGE END
Hope it works for you.
Thanks
Bookmarks