Load ATG Order

Crystal Ball | FlickrCrystal Ball by David Reece

You can always look up an order in the repository using it’s ID.  But then you want to use the properties of this order object you will always be calling getPropertyValue and casting it to the type you expect.

A better and much simpler way is to look up the order using the OrderManager.  Then you get a strongly typed Order object and don’t have have to deal with the repository.  Life has become a little easier. 🙂

OrderManager orderManager = getOrderManager;
Order order = orderManager.loadOrder(orderId);


Now that you have the order you can also get the profile for that order.

RepositoryItem profile = getProfileTools().getProfileForOrder(order);

10 thoughts on “Load ATG Order

  1. The loadOrder method invokes the whole Pipeline. Don’t you think it will be a heavy operation if I have to load n number of orders?

  2. Hi Binish,
    Yes it could be heavy to load N number of orders using the loadOrder method.
    I guess it depends on what you want to do and why you want to do it.
    -Frank

  3. My requirement is to calculate what is the total amount of all the orders on a particular day. When I say total I mean amount after shipping and tax and orders in complete state.
    I can always write an RQL for this but do we have any such thing in OOB.

  4. Since this would be part of a scheduled task loading all the orders for the day and summing it probably won’t be a big performance issue. But if you are concerned you could really optimize by using SQL and not even use the ATG API.

  5. Hi i am new to ATG commerce, can any one kindly tell me that when an order object will be created and when an order object will be created for a gust user and when a order object will be created for logged in user.

    Many thanks

  6. Hi!

    Actually we have a problem with the loadOrder function from OrderManager… We thought that loadOrder refresh entiry the order structure from repository… But loggeds in a open session, we modify the shopping cart from another session (an mobile app) with a ATG webservice (additemtoorder)… Then from original session we load the order from orderManager but the order isn’t correctly been refreshed… because when we try to add to the order from the store we have an error…

    It’s possible that the Order was not entiry refreshed??

Leave a Reply

Your email address will not be published. Required fields are marked *