Index: branches/5.2.x/units/orders/orders_event_handler.php =================================================================== diff -u -N -r16234 -r16237 --- branches/5.2.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 16234) +++ branches/5.2.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 16237) @@ -1,6 +1,6 @@ GetId(), $ord_id, $sub_order_data['PackageNum']); + $query = ' UPDATE ' . $table_prefix . 'OrderItems + SET OrderId = %s, PackageNum = 1 + WHERE OrderId = %s AND PackageNum = %s'; + $query = sprintf($query, $sub_order->GetID(), $ord_id, $sub_order_data['PackageNum']); break; case PRODUCT_TYPE_DOWNLOADABLE: - $query = 'UPDATE '.$table_prefix.'OrderItems SET OrderId = %s WHERE OrderId = %s AND ProductId IN (%s)'; - $query = sprintf($query, $sub_order->GetId(), $ord_id, implode(',', $product_ids) ); + $query = ' UPDATE ' . $table_prefix . 'OrderItems + SET OrderId = %s, PackageNum = 1 + WHERE OrderId = %s AND ProductId IN (%s)'; + $query = sprintf($query, $sub_order->GetID(), $ord_id, implode(',', $product_ids)); break; default: - $query = 'UPDATE '.$table_prefix.'OrderItems SET OrderId = %s WHERE OrderId = %s AND OrderItemId = %s'; - $query = sprintf($query, $sub_order->GetId(), $ord_id, $named_grouping_data['OrderItemId']); + $query = ' UPDATE ' . $table_prefix . 'OrderItems + SET OrderId = %s, PackageNum = 1 + WHERE OrderId = %s AND OrderItemId = %s'; + $query = sprintf($query, $sub_order->GetID(), $ord_id, $named_grouping_data['OrderItemId']); break; }