Ok, i'm figuring out a way to upgrade Kenneth Wang's & Jian Wang's Canadian Seperate Tax Hack 1.2-4 for MS1 which by the way is a great contrubution because it simply does not modify any files in order for it to work and includes a separate shipping tax display, but i need major help!
http://www.oscommerce.com/community/contri...ions,289/page,2
Right now I only have it partially working for the files ot_tax_gst.php and ot_tax_pst.php (it will display proper GST, GST#, & PST values, however, both GST and PST always appears to be visible despite tax zones:
includesmodulesorder_totalot_tax_gst.php
<?php
/*
$Id: ot_tax_gst.php,v 1.14 2003/02/14 05:58:35 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class ot_tax_gst {
var $title, $output;
function ot_tax_gst() {
$this->code = 'ot_tax_gst';
$this->title = MODULE_ORDER_TOTAL_TAX_GST_TITLE . ' #' . MODULE_ORDER_TOTAL_TAX_GST_NUMBER;
$this->description = MODULE_ORDER_TOTAL_TAX_GST_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_TAX_GST_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_TAX_GST_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies;
reset($order->info['tax_groups']);
while (list($key, $value) = each($order->info['tax_groups'])) {
if ($value > 0) {
$this->output[] = array('title' => $this->title . ' ( 7% ):',
'text' => $currencies->format($order->info['subtotal']*(0.07), true, $order->info['currency'], $order->info['currency_value']),
'value' => $value);
}
}
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAX_GST_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_TAX_GST_STATUS', 'MODULE_ORDER_TOTAL_TAX_GST_SORT_ORDER', 'MODULE_ORDER_TOTAL_TAX_GST_NUMBER');
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_GST_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array('true', 'false'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_GST_SORT_ORDER', '2', 'Sort order of display.', '6', '2', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('GST Number', 'MODULE_ORDER_TOTAL_TAX_GST_NUMBER', '', 'input your business's GST Number.', '6', '3', now())");
}
function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}
?>
includesmodulesorder_totalos_tax_pst.php
<?php
/*
$Id: ot_tax_pst.php,v 1.14 2003/02/14 05:58:35 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class ot_tax_pst {
var $title, $output;
function ot_tax_pst() {
$this->code = 'ot_tax_pst';
$this->title = MODULE_ORDER_TOTAL_TAX_PST_TITLE;
$this->rate = MODULE_ORDER_TOTAL_TAX_PST_RATE;
$this->description = MODULE_ORDER_TOTAL_TAX_PST_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_TAX_PST_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_TAX_PST_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies;
reset($order->info['tax_groups']);
while (list($key, $value) = each($order->info['tax_groups'])) {
if ($value > 0) {
$this->output[] = array('title' => $this->title . ' ( ' . $this->rate . '% ):',
'text' => $currencies->format($order->info['subtotal']*($this->rate / 100), true, $order->info['currency'], $order->info['currency_value']),
'value' => $value);
}
}
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAX_PST_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_TAX_PST_STATUS', 'MODULE_ORDER_TOTAL_TAX_PST_RATE', 'MODULE_ORDER_TOTAL_TAX_PST_SORT_ORDER');
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_PST_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array('true', 'false'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PST Rate', 'MODULE_ORDER_TOTAL_TAX_PST_RATE', '8', 'PST Rate (%, i.e. input 8 for 8%)', '6', '2', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_PST_SORT_ORDER', '3', 'Sort order of display.', '6', '3', now())");
}
function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}
?>
If anybody knows how to code a comparison between the billing zone with the appropriate tax zones, by all means please share (im a php newbie). By comparing the billing zone & tax zones I think it would be possible to make the GST and/or PST visible and invisible when both zones match or mismatch respectively.
This current contribution works for late november versions. I just don't know how or why its not working for current snapshots! :shock:
-Martin.