ok... i have taken a cursory look, and i'll add a few comments and then i will move on.
first off, props to you @lat9 for taking this mess on! i appreciate all of the documentation you have added (not that i understand it..), and eventually this will possibly make more sense to me...
similar to you, i come from an old school background, learning old school procedural languages, before transitioning into OOP. unlike you, i have not picked it up nearly as well.... ;)
some of the things that i have been forced to focus on deal with totals, and how ot_* groups never add up.
let's look at ot_subtotal.
here is some code that i was forced to add:
Code:
function eo_update_order_subtotal($order_id, $product, $add = true) {
global $currencies, $db, $order;
// forget their stuff... just recalculate
$RunningSubTotal = 0;
$RunningTax = 0;
foreach($order->products as $products_details) {
$RunningSubTotal += $products_details["qty"] * $products_details["final_price"];
$RunningTax += (($products_details["tax"]/100) * ($products_details["qty"] * $products_details["final_price"]));
$TaxRate = $products_details["tax"]/100; // assume tax rate the same for all products
}
// Retrieve running subtotal
i have ZERO confidence in the amount in ot_subtotal. in fact, i had to create a new function to recalculate the ot_subtotal! granted, i'm making assumptions based on my knowledge of the constants stored in the configuration table, but still...
whether the ot_subtotal amount in your new version is correct now, i can not say.... but i swore off debugging this module! its just easier to recalculate it on my own.
Bookmarks