# Review Follow-ups

Date: 2026-06-02

## Priority Recommendations

1. Restore OpenCart checkout order lifecycle behavior.
   - New orders created by `catalog/model/checkout/order.php::addOrder()` should remain `order_status_id = 0`.
   - Payment controllers should set the real order status by calling `addOrderHistory()` only after confirmation.
   - This prevents abandoned or failed online-payment orders from appearing as placed customer orders.

2. Move request-time schema changes out of customer account pages.
   - Remove `SHOW INDEX` / `ALTER TABLE` work from `catalog/model/account/order.php`.
   - Apply those indexes through a migration, install/upgrade script, or deployment SQL instead.
   - Customer-facing requests should remain read-only against the schema.

3. Keep the account order batch-query optimizations.
   - `getOrderItemTotalsByOrderIds()`
   - `getOrderOptionsByProductIds()`
   - `getActiveProductIds()`
   These are useful once schema changes are handled outside the request path.

4. Review `dreamer_theme` permissions.
   - Broad read access may be acceptable if intentional.
   - Modify access should stay explicit.
   - Test users with limited permissions such as `product_badge`, `homepage_manager`, and footer-only roles.

## Edge Cases To Test

1. Online payment started but abandoned.
   - Order should stay status `0`.
   - It should not appear as a placed customer order.

2. Online payment completed successfully.
   - Gateway confirmation/callback should call `addOrderHistory()`.
   - Order should become visible with the correct payment status.

3. COD checkout.
   - `catalog/controller/extension/payment/cod.php` should call `addOrderHistory()`.
   - Order should appear with the configured COD status.

4. Bank transfer or other offline methods.
   - Confirm whether the business expects immediate pending-order visibility.
   - If yes, that payment module should explicitly set a pending status.

5. Account order history performance.
   - Run the index migration before relying on batch-query speed in production.
   - Avoid DDL from frontend requests, especially on large order tables.

6. Reorder behavior.
   - Previously ordered products that are now disabled, unavailable, or not assigned to the current store should not show reorder links unless the business wants otherwise.
