FWIW, here's how I corrected my issue (/YOUR_ADMIN/includes/functions/extra_functions/edit_orders_functions.php):
Code:
function eo_update_database_order_totals($oID) {
global $db, $order;
// Load required modules for order totals if enabled
if(defined('MODULE_ORDER_TOTAL_INSTALLED') && zen_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {
// Load order totals.
require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'order_total.php');
$GLOBALS['order_total_modules'] = new order_total();
// Load the shopping cart class into the session
eo_shopping_cart();
// This fixes an issue caused by ot_shipping assuming shipping tax amount
// has not already been added to the shipping cost and order tax.
if(array_key_exists('shipping_tax', $order->info)) {
$order->info['tax'] -= $order->info['shipping_tax'];
if (DISPLAY_PRICE_WITH_TAX == 'true') $order->info['shipping_cost'] -= $order->info['shipping_tax'];
}
// Reset the final total (include tax if not already tax-inc)
// This code causes the order totals to be correctly calculated.
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$order->info['total'] = $order->info['subtotal'] + $order->info['shipping_cost'];
} else {
$order->info['total'] = $order->info['subtotal'] + $order->info['tax'] + $order->info['shipping_cost'];
}
// Process the order totals
$order_totals = $GLOBALS['order_total_modules']->process();
// Update the order totals in the database
for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
eo_update_database_order_total($oID, $order_totals[$i]);
}
//-BOF-lat9-account for order total modules that have been removed
if (count ($order->totals) > $n) {
for ($i=0, $totals_titles = array (); $i<$n; $i++) {
$totals_titles[] = $order_totals[$i]['title'];
}
for ($i=0, $n=count($order->totals); $i<$n; $i++) {
if (!in_array ($order->totals[$i]['title'], $totals_titles)) {
$db->Execute ("DELETE FROM " . TABLE_ORDERS_TOTAL . " WHERE orders_id = $oID AND title = '" . zen_db_input ($order->totals[$i]['title']) . "' LIMIT 1");
}
}
unset ($totals_titles);
}
//-EOF-lat9
unset($order_totals);
}
}
Bookmarks