Order Modification

If the order needs to be changed (e.g. products added or removed, addition of a coupon code or change of address etc.) this must be done through the KonaKart APIs or the storefront application. Rather than modifying the existing order, a new order is created and the state of the existing order is changed to the Archived state.

Configuration variables under Configuration >> Stock and Orders allow you to define the states of orders that are included or excluded from the storefront. A default installation excludes state 14 which means that archived orders are not normally displayed to the customer.

The first step to allow order modification is to set the configuration variables under Configuration >> Store Configuration as shown above.

Next the customer must be selected in the Admin App Customers panel and the Login button clicked in order for the administrator to log into the storefront application as the customer.

As can be seen from the image above, next to each of the customer orders there is an edit button that allows the administrator to edit the order. Clicking the button takes the administrator to the Manage Shopping Cart panel where products may be removed and quantities changed. From other areas of the storefront, new products may also be added to the cart.

The checkout confirmation panel also has some added functionality as can be seen above.

If at this point, the administrator decides to create a new order rather than to edit an existing order, there is a link that can be clicked directly underneath the title.

If enabled, the administrator can also manually enter a discount which immediately appears on the order. This may be useful for cases when the administrator needs to match a lower price seen elsewhere or needs to apply a special discount for whatever reason. This discount is managed by the "Order Total Discount Defined By Administrator" promotion module which must be enabled. Also a promotion needs to be created using this promotion module. When creating the promotion, you may decide to make the discount an amount or a percentage discount.

When the Confirm Order button is clicked, the new order is saved and the old order is moved to the Archived state and is no longer visible in the list of orders in the storefront application. However, whenever a customer views the details of an order that has an archived order, the details of the archived order may be viewed by clicking the button shown above. The same applies for the Admin App.

There is no default logic implemented for how payment or refunds should be handled for edited orders since this will really depend on your implementation and details such as whether the administrator can enter credit card details over the phone. One possibility is to edit the module com.konakart.bl.modules.ordertotal.total.Total.java in order to calculate a new total based on the archived orders of the current order rather than just returning the total of the current order. Some commented code has been added to com.konakart.bl.modules.ordertotal.total.Total.java that demonstrates how to retrieve the previous orders of the order currently being edited.

Whenever a customer order is created by an administrator, we keep track of the user id of the administrator and save this information with the order in the creator attribute. As can be seen above, this information is also visible from the Admin App.