| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/includes/modules/order_total/ |
Upload File : |
<?php
/* --------------------------------------------------------------
ot_loworderfee.php 2019-04-18
Gambio GmbH
http://www.gambio.de
Copyright (c) 2019 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/* -----------------------------------------------------------------------------------------
$Id: ot_loworderfee.php 1002 2005-07-10 16:11:37Z mz $
XT-Commerce - community made shopping
http://www.xt-commerce.com
Copyright (c) 2003 XT-Commerce
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(ot_loworderfee.php,v 1.11 2003/02/14); www.oscommerce.com
(c) 2003 nextcommerce (ot_loworderfee.php,v 1.7 2003/08/24); www.nextcommerce.org
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
class ot_loworderfee_ORIGIN
{
public $code;
public $title;
public $output;
public $description;
public $enabled;
public $sort_order;
public function __construct()
{
$this->code = 'ot_loworderfee';
$this->title = defined(
'MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE'
) ? MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE : '';
$this->description = defined(
'MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION'
) ? MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION : '';
$this->enabled = defined('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS')
&& MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS === 'true';
$this->sort_order = defined(
'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER'
) ? MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER : '0';
$this->output = [];
}
public function process()
{
require_once DIR_FS_INC . 'xtc_calculate_tax.inc.php';
$order = $GLOBALS['order'];
$xtPrice = $GLOBALS['xtPrice'];
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE === 'true') {
$pass = false;
$deliveryCountryId = $order->delivery['country_id'];
$deliveryZoneId = $order->delivery['zone_id'];
if (null === $deliveryCountryId) {
if (!empty($_SESSION['delivery_zone'])) {
/** @var \CountryService $countryService */
$countryService = StaticGXCoreLoader::getService('Country');
$deliveryCountry = $countryService->getCountryByIso2($_SESSION['delivery_zone']);
$deliveryCountryId = $deliveryCountry->getId();
$deliveryZoneId = $countryService->getUnknownCountryZoneByName('unknown zone')->getId();
} else {
$this->output = [];
return;
}
}
switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
case 'national':
if ((int)$deliveryCountryId === (int)STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ((int)$deliveryCountryId !== (int)STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
default:
$pass = false;
break;
}
if (($pass === true)
&& (($order->info['total'] - $order->info['shipping_cost'])
< MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER)) {
$low_order_fee = 0.0;
$tax = xtc_get_tax_rate(
MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS,
$deliveryCountryId,
$deliveryZoneId
);
$tax_description = xtc_get_tax_description(
MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS,
$deliveryCountryId,
$deliveryZoneId
);
if ((int)$_SESSION['customers_status']['customers_status_show_price_tax'] === 1) {
$order->info['tax'] += xtc_calculate_tax(
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE,
$tax
);
$order->info['tax_groups'][TAX_ADD_TAX . $tax_description] += xtc_calculate_tax(
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE,
$tax
);
$order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE
+ xtc_calculate_tax(
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE,
$tax
);
$low_order_fee = xtc_add_tax(
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE,
$tax
);
}
if ((int)$_SESSION['customers_status']['customers_status_show_price_tax'] === 0
&& (int)$_SESSION['customers_status']['customers_status_add_tax_ot'] === 1) {
$low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
$order->info['tax'] += xtc_calculate_tax(
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE,
$tax
);
$order->info['tax_groups'][TAX_NO_TAX . $tax_description] += xtc_calculate_tax(
MODULE_ORDER_TOTAL_LOWORDERFEE_FEE,
$tax
);
$order->info['subtotal'] += $low_order_fee;
$order->info['total'] += $low_order_fee;
}
if ((int)$_SESSION['customers_status']['customers_status_show_price_tax'] === 0
&& (int)$_SESSION['customers_status']['customers_status_add_tax_ot'] !== 1) {
$low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
$order->info['subtotal'] += $low_order_fee;
$order->info['total'] += $low_order_fee;
}
$this->output[] = [
'title' => $this->title . ':',
'text' => $xtPrice->xtcFormat($low_order_fee, true),
'value' => $low_order_fee,
];
}
}
}
public function check()
{
if (!isset($this->_check)) {
$check_query = xtc_db_query(
sprintf(
"select `configuration_value` from `%s` where `configuration_key` = 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS'",
TABLE_CONFIGURATION
)
);
$this->_check = xtc_db_num_rows($check_query);
}
return $this->_check;
}
public function keys()
{
return [
'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS',
'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER',
'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE',
'MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER',
'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE',
'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION',
'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS',
];
}
public function install()
{
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'true', '6', '1','gm_cfg_select_option(array(\'true\', \'false\'), ', now())"
);
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', '11', '6', '2', now())"
);
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'false', '6', '3', 'gm_cfg_select_option(array(\'true\', \'false\'), ', now())"
);
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', '50','6', '4', 'currencies->format', now())"
);
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', '5','6', '5', 'currencies->format', now())"
);
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'both','6', '6', 'xtc_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())"
);
xtc_db_query(
'insert into ' . TABLE_CONFIGURATION
. " (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) values ('MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS', '0','6', '7', 'xtc_get_tax_class_title', 'xtc_cfg_pull_down_tax_classes(', now())"
);
}
public function remove()
{
xtc_db_query(
'delete from ' . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys())
. "')"
);
}
}
MainFactory::load_origin_class('ot_loworderfee');