How To Create an Order Total Module
Order total modules can produce lines that are displayed in the order total summary for an order. It can both specify amounts or add/subtract amounts indicated by the parameter "calculate".
~/includes/modules/order_total/ot_summary_line.inc.php:
<?php
class ot_summary_line {
public $id = __CLASS__;
public $name = 'Summary Line';
public $description = '';
public $author = 'LiteCart Dev Team';
public $version = '1.0';
public $website = 'https://www.litecart.net';
public $priority = 0;
public function process($order) {
if (empty($this->settings['status'])) return;
$output = [];
$output[] = [
'title' => 'My Summary Line',
'value' => 0.00,
'tax' => 0.00,
'calculate' => false, // Set to true will append the value and tax to the payment due
];
return $output;
}
function settings() {
return [
[
'key' => 'status',
'default_value' => '1',
'title' => 'Status',
'description' => 'Enables or disables the module.',
'function' => 'toggle("e/d")',
],
[
'key' => 'priority',
'default_value' => '30',
'title' => 'Priority',
'description' => 'Process this module by the given priority value.',
'function' => 'number()',
],
];
}
// Run some code when the module is installed
public function install() {}
// Run some code when the module is uninstalled
public function uninstall() {}
}