Following code in the "orditems:OnUpdate
" event
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
if ( $this->Application->GetVar('t') != 'in-commerce/orders/orders_edit_items' ) { return; } $sub_total = $this->getSubTotal($items_info); if ( $sub_total !== false ) { $main_object->SetDBField('SubTotal', $sub_total); } $main_object->SetDBField('ReturnTotal', $this->getReturnTotal($items_info)); $main_object->Update(); |
...
What's wrong with this code is that SubTotal is also calculated in the "ord:OnRecalculateItems
" event, which called on any order update (this one included).
Solution
- move "ReturnTotal" field calculation to the
OrderManager::setOrderTotals
method - remove above mentioned code from
orditems:OnUpdate
event