Hi lat9,
The Admin New Order plugin creates database entries for the order, orders_totals, and orders_status_history tables with an order that contains no products, and then redirects to edit_orders. I believe it does this since edit_orders does (or did) expect these tables to exist and uses them in editting orders created on the store_side.
As noted in earlier posts, new_order.php while creating the order totals, calls function zen_get_tax_locations. I believe that the author of the Admin New Order plugin intended that the store-side version of the function be used, but that version is not loaded in the admin. Your version of the function won't work because $eo has not been created. And even if the store-side version were loaded, edit_orders would fail because it tests for an existing loaded version of the function, and if found, exits with an error message.
so the only way I could figure to get the store-side version of the function loaded is to merge it into your version of the function, like so:
Code:
if (function_exists ('zen_get_tax_locations')) {
trigger_error ('Pre-existing zen_get_tax_locations function detected.', E_USER_ERROR);
exit ();
} else {
function zen_get_tax_locations($store_country = -1, $store_zone = -1) {
if (basename($PHP_SELF) == FILENAME_EDIT_ORDERS) {
....contents of your version of the function
} else {
....contents of the store-side version of the function
}
}
}
I did not include the protective code you posted earlier that prevents loading functions if called from other plugins. But, although the orders_total table was created without error in new_order.php, edit_orders.php didn't fare as well. Tax calculations were applied when they shouldn't, probably because I did something wrong in the merge. I think it should work, but I'm giving up on this approach.
Anyway, I'm back to commenting out the code in new_order.php that creates the orders_totals table. Edit orders appears to work. But I would really appreciate your opinion of any ramifications to EO if called without an orders_totals table in the database.
Thanks,
Dave
Bookmarks