ECommerce Order Data

Keith Donnell asked on October 8, 2015 18:03

We are implementing an order history page, and I am wondering how to get the following data from an OrderInfo object:

  1. Has Shipped? (We could probably use Tracking Number is not empty?)
  2. Date Shipped
  3. Order Line Items

Thanks!

Correct Answer

Timothy Fenton answered on November 23, 2015 13:17

Hello Keith, sorry if it is a little late, but just saw this post went unanswered. So I will try to answer the questions in the order you asked:

  1. Has shipped is not recorded by default, there could be two ways to do this. First, your solution - checking if the tracking number is null or empty would be great as it does not require any changes and it is pretty reliable. The second is to add another order status to order status options called "ItemShipped" or similar and you can mark it as shipped when the order ships.

  2. The second option I have given above, adding another order status, something like "OrderShipped" could help you here. If when an order ships you can mark the order as shipped that will become the status held in "StatusID" and the "LastModifiedDate" will update to the time that was set. Another option could be to add a custom field like "OrderShipDate" to the com.order class and handle the Order Update event from global events:

    https://docs.kentico.com/display/K82/Reference+-+Global+system+events

    it would be something like OrderInfo.TYPEINFO.Events.Update.After and you would get the status id, if it is shipped status and the order does not already have a OrderShipDate set then record the DateTime.Now as the value for the "OrderShipDate".

  3. So if you have the OrderInfo object already you can access the items within the order by calling the OrderItemInfoProvider.GetOrderItems(int orderid) method like this:

    OrderItemInfoProvider.GetOrderItems(yourOrderInfoObject.OrderID);

Hope this helps!

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.