SalesEdit on GitHub
The Sales module provides the order management functionality. The functionality is obtained through the ZED UI that renders orders with orders details and the Client API to get customer orders.
Getting Totals for Order
To get the Order with totals, the facade method SalesFacade::getOrderByIdSalesOrder() creates an order level which returns the OrderTransfer with a hydrated grandTotal, subtotal, expense, discounts and more
Persisting Order Calculated Values
All calculated values are persisted now, when order are first placed. The values are stored by orderSaver plugins from checkout bundle. Check
\Pyz\Zed\Checkout\CheckoutDependencyProvider::getCheckoutOrderSavers for currently available plugins.
Some values can change during time when order refunded or partially refunded. Then
refundable_amount are recalculated and new values is persisted. At the same moment totals also change, but it does not overwrite old entry, but creates new row in
spy_sales_order_total with this you have a history of order totals from the time order was placed.
The following ER diagram shows persisted calculated values:
HydrateOrderPluginInterface - its an action which happens when
SalesFacade::getOrderByIdSalesOrder() method is called. This means that you may want to enrich you
OrderTransfer with additional data. This plugins accepts passes
OrderTransfer for additional population.
There are already few plugins provided:
OrderTransferwith discount related data as it was stored when order is placed.
OrderTransferwith product option related data.
OrderTransferwith product bundle related data.
OrderTransferwith shipment related data.
For submitting the form