Code:
<?php
/**
* ot_total order-total module
*
* @package orderTotal
* @copyright Copyright 2003-2007 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: ot_loworderfee.php 6101 2007-04-01 10:30:22Z wilt $
*/
class ot_sales_tax {
var $title, $output;
function ot_sales_tax() {
$this->code = 'ot_sales_tax';
$this->title = MODULE_ORDER_TOTAL_SALES_TAX_TITLE;
$this->description = MODULE_ORDER_TOTAL_SALES_TAX_DESCRIPTION;
$this->sort_order = MODULE_ORDER_TOTAL_SALES_TAX_SORT_ORDER;
$this->output = array();
}
function process() {
global $order, $currencies;
if (MODULE_ORDER_TOTAL_SALES_TAX == 'true') {
// calculate from flat fee or percentage
$sales_tax_defined = zen_get_sales_tax($sales_tax);
$sales_tax_value = ($order->info['subtotal'] * ($sales_tax_defined/100));
$order->info['total'] += $sales_tax_value;
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($sales_tax_value, true, $order->info['currency'], $order->info['currency_value']),
'value' => $sales_tax_value);
}
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = "select configuration_value
from " . TABLE_CONFIGURATION . "
where configuration_key = 'MODULE_ORDER_TOTAL_SALES_TAX_STATUS'";
$check_query = $db->Execute($check_query);
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_SALES_TAX_STATUS', 'MODULE_ORDER_TOTAL_SALES_TAX_SORT_ORDER', 'MODULE_ORDER_TOTAL_SALES_TAX', 'MODULE_ORDER_TOTAL_SALES_TAX_FEE');
}
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('This module is installed', 'MODULE_ORDER_TOTAL_SALES_TAX_STATUS', 'true', '', '6', '1','zen_cfg_select_option(array(\'true\'), ', now())");
$db->Execute("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_SALES_TAX_SORT_ORDER', '400', 'Sort order of display.', '6', '2', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Low Order Fee', 'MODULE_ORDER_TOTAL_SALES_TAX', 'false', 'Do you want to allow low order fees?', '6', '3', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Order Fee', 'MODULE_ORDER_TOTAL_SALES_TAX_FEE', '5', 'Enter your percentage', '6', '5', '', now())");
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}
?>
Basically, what I'm trying to achieve is to get the ot module to find out the following:
Bookmarks