OK, here's what corrected the issue for me. I made these changes to the eo_get_order_by_order_id function of /YOUR_ADMIN/includes/functions/extra_functions/edit_orders_functions.php:
Code:
function eo_get_order_by_id($oID) {
global $db, $order;
// Retrieve the order
$order = new order($oID);
// Add some required customer information for tax calculation
// The next method has been modified to add required info to the
// session and global variables.
zen_get_tax_locations();
// Cleanup tax_groups in the order (broken code in order.php)
// Shipping module will automatically add tax if needed.
$order->info['tax_groups'] = array();
foreach($order->products as $product) {
eo_get_product_taxes($product);
}
// Correctly add the running subtotal (broken code in order.php)
if(!array_key_exists('subtotal', $order->info)) {
$query = $db->Execute(
'SELECT value FROM `' . TABLE_ORDERS_TOTAL . '` ' .
'WHERE `orders_id` = \'' . (int)$oID . '\' ' .
'AND `class` = \'ot_subtotal\''
);
if(!$query->EOF) {
$order->info['subtotal'] = $query->fields['value'];
}
}
// Convert country portion of addresses to same format used in catalog side
$country = null;
if(array_key_exists('country', $order->customer)) {
$country = eo_get_country($order->customer['country']);
if($country !== null) {
$order->customer['country'] = $country;
$order->customer['zone_id'] = zen_get_zone_id($order->customer['country']['id'], $order->customer['state']);
}
}
if(array_key_exists('country', $order->delivery)) {
$country = eo_get_country($order->delivery['country']);
if($country !== null) {
$order->delivery['country'] = $country;
$order->delivery['zone_id'] = zen_get_zone_id($order->delivery['country']['id'], $order->delivery['state']);
}
}
if(array_key_exists('country', $order->billing)) {
$country = eo_get_country($order->billing['country']);
if($country !== null) {
$order->billing['country'] = $country;
$order->billing['zone_id'] = zen_get_zone_id($order->billing['country']['id'], $order->billing['state']);
}
}
unset($country);
// Handle shipping costs (module will automatically handle tax)
if(!array_key_exists('shipping_cost', $order->info)) {
$query = $db->Execute(
'SELECT value FROM `' . TABLE_ORDERS_TOTAL . '` ' .
'WHERE `orders_id` = \'' . (int)$oID . '\' ' .
'AND `class` = \'ot_shipping\''
);
if(!$query->EOF) {
$order->info['shipping_cost'] = $query->fields['value'];
$_SESSION['shipping'] = array(
'title' => $order->info['shipping_method'],
'id' => $order->info['shipping_module_code'] . '_',
'cost' => $order->info['shipping_cost']
);
if(!isset($_SESSION['cart'])) {
require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'shopping_cart.php');
$_SESSION['cart'] = new shoppingCart();
}
// Load the shipping class into the globals
require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping($_SESSION['shipping']);
}
}
//-bof-20130814-lat9
// Special handling for coupons: Need to set the coupon_id associated with the coupon into
// the session for the coupon amount to be automatically recalculated.
unset($_SESSION['cc_id']);
if (isset($order->info['coupon_code']) && zen_not_null($order->info['coupon_code'])) {
$coupon_info = $db->Execute('SELECT c.coupon_id FROM ' . TABLE_COUPONS . ' c, ' . TABLE_COUPON_REDEEM_TRACK . " crt
WHERE c.coupon_id = crt.coupon_id
AND c.coupon_code = '" . $order->info['coupon_code'] . "'
AND crt.order_id = " . (int)$oID);
if (!$coupon_info->EOF) {
$_SESSION['cc_id'] = $coupon_info->fields['coupon_id'];
}
}
//-eof-20130814-lat9
return $order;
}
Bookmarks