Hallo zusammen,
ich hatte beim Modulbau zur Differnzbesteuerung die Idee, die ot_module manipulierbar zu machen.
Somit können mit Klassenerweiterungsmodulen die Module modifiziert oder auch abgefangen werden.
Interessant finde ich das auch im Zusammenhang mit der Kleinunternehmerregelung.
Momentan muß dort das Steuer-Modul und das Modul Netto-Summe deinstalliert werden. Das wäre dann obsolet.
Ich stelle euch einfach mal das Ganze vor. Vielleicht besteht Interesse
Die zwei Dateien hab ich noch mit dran gehangen
------------------------------------------------------------
/includes/classes/checkoutModules.class.php
------------------------------------------------------------
Finde:
function unallowed_shipping_modules($unallowed_modules)
{
$this->function_call = 'unallowed_shipping_modules';
return $this->call_module_method($unallowed_modules);
}
Füge danach ein:
function manipulate_output_array($arr_output)
{
$this->function_call = 'manipulate_output_array';
return $this->call_module_method($arr_output);
}
function manipulate_output($output)
{
$this->function_call = 'manipulate_output';
return $this->call_module_method($output);
}
------------------------------------------------------------
/includes/classes/order_total.php
------------------------------------------------------------
Finde:
function __construct() {
global $order;
Füge danach ein:
//new module support
require_once (DIR_FS_CATALOG.'includes/classes/checkoutModules.class.php');
$this->checkoutModules = new checkoutModules();
Finde:
function process
() { $order_total_array = array (); if (is_array($this->modules)) { reset($this->modules); foreach ($this->modules as $value) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->output = array(); $GLOBALS[$class]->process(); for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i ++) { if (xtc_not_null
($GLOBALS[$class]->output[$i]['title']) && xtc_not_null
($GLOBALS[$class]->output[$i]['text'])) { $order_total_array[] = array ( 'code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => ((isset($GLOBALS[$class]->output[$i]['sort_order'])) ?
$GLOBALS[$class]->output[$i]['sort_order'] : $GLOBALS[$class]->sort_order) ); } } } } } return $order_total_array; } Ersetze mit:
function process
() { $order_total_array = array (); if (is_array($this->modules)) { reset($this->modules); foreach ($this->modules as $value) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->output = array(); $GLOBALS[$class]->process(); for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i ++) { if (xtc_not_null
($GLOBALS[$class]->output[$i]['title']) && xtc_not_null
($GLOBALS[$class]->output[$i]['text'])) { $order_total_array[] = array ( 'code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => ((isset($GLOBALS[$class]->output[$i]['sort_order'])) ?
$GLOBALS[$class]->output[$i]['sort_order'] : $GLOBALS[$class]->sort_order) ); } } } } } //new module support $order_total_array = $this->checkoutModules->manipulate_output_array($order_total_array); return $order_total_array; } Finde:
function output
() { $output_string = ''; if (is_array($this->modules)) { reset($this->modules); foreach ($this->modules as $value) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $size = sizeof($GLOBALS[$class]->output); for ($i = 0; $i < $size; $i ++) { $output_string .= ' <tr>'."\n".' <td align="right" class="main">'.$GLOBALS[$class]->output[$i]['title'].'</td>'."\n".' <td align="right" class="main">'.$GLOBALS[$class]->output[$i]['text'].'</td>'."\n".' </tr>'; } } } } return $output_string; } Ersetze mit:
function output
() { $output_string = ''; if (is_array($this->modules)) { reset($this->modules); foreach ($this->modules as $value) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $size = sizeof($GLOBALS[$class]->output); for ($i = 0; $i < $size; $i ++) { $output_string .= ' <tr>'."\n".' <td align="right" class="main">'.$GLOBALS[$class]->output[$i]['title'].'</td>'."\n".' <td align="right" class="main">'.$GLOBALS[$class]->output[$i]['text'].'</td>'."\n".' </tr>'; } } } } //new module support $output_string = $this->checkoutModules->manipulate_output($output_string); return $output_string; } VG Bert
Linkback: https://www.modified-shop.org/forum/index.php?topic=40975.0