This content has been marked as final. Show 13 replies
When you first add an item to order, SHoppingCart($class is OrderHolder) component's current property is checked if user has any order, if it doesnt, it asks OrderManager to create an Order.
OrderManager create the initialOrder by building OrderImpl object from OrderTools, CommerceItem from CommerceItemManager, similarly creates Empty Shipping Group, Empty payment group, creates ItemPriceInfo and adds it to commerceItem and then CommerceItem is added to Order object.
ShoppingCart is a session based component. So with session establishment, the component is created and its properties such as last placed order, saved order are populated based on profile's auto login property (cookie).
If there is no autologin, user is just anonymous coming to site for the first time, then those are empty and they get populated when you add an item to cart.
When you try to access this ShoppingCart.current in a JSP page, the order is created, It calls the handle create method in OrderHolder class. You need not add item to cart to create an order.
Just try printing the ShoppingCart.current in your index.jsp , Order is created without commerce items.
I think thats what "shy" was asking for.
Correct me if i am wrong.
My question is how that order object is created????
When you access the ShoppingCart.current in your jsp page. Handle create method in the OrderHolder class is called. From the
OrderHolder.handleCreate ->OrderHolder.createInitailOrder-->OrderManager.createOrder (These are the methods that get called when you access Shopping.current in your jsp, which will create a Order Object for the current profile profile).
Is the HandleCreate method in the OrderHolder class will be called.when the session start????.
Its not when the session starts, its when you access the ShoppingCart.current . (There are different ways an order is created) one of the way is when u access ShoppingCart.current, CartmodifierFormhandler.additemtoOrder etc etc..
See understand whats ur doubt exactly. Like how profile is getting created when session starts, you want to know how order is getting created right.
Profile is created in the DAF request pipeline in ProfileRequestServlet , but order does not get created in request pipeline. but it gets created in may ways, like i mentioned above.
U have only index.jsp in your atg project in which profile is displayed. until and unless you use or access shoppingcart.current order is not created.
when you use the above code to print order, it calls the handle create. hope i cleared your doubt
You are right about Order creation, you need not add item to cart to actually create an order. The very call to SHoppingCart.current creates it.
But the likely scenario of one calling that method is when adding item to the cart. Even if you call by directly going to cart page, the cart would be empty. You would not really call ShoppingCart.current on productDetail, main page e.t.c unless you have a mini cart in main page.
What is your doubt exactly.??? How order get created or when order gets created.???
See the OrderManager class, it has createorder method which takes different set of parameters.
createOrder(String pProfileId, String pOrderType)
createOrder(String pProfileId, String pOrderId, String pOrderType)
createOrder(String pProfileId, OrderPriceInfo pOrderPriceInfo, TaxPriceInfo pTaxPriceInfo, ShippingPriceInfo pShippingPriceInfo)
createOrder(String pProfileId, OrderPriceInfo pOrderPriceInfo, TaxPriceInfo pTaxPriceInfo, ShippingPriceInfo pShippingPriceInfo, String pOrderType)
createOrder(String pProfileId, String pOrderId, OrderPriceInfo pOrderPriceInfo, TaxPriceInfo pTaxPriceInfo, ShippingPriceInfo pShippingPriceInfo, String pOrderType)
You need to go through the Oracle-ATG doc. It will help you. If you still have doubts you can get back.
you have mentioned in the past post like
(There are different ways an order is created) one of the way is when u access ShoppingCart.current, CartmodifierFormhandler.additemtoOrder etc etc..
is there any other way to create an order object like which u mentioned above,
i didnt asked the create order overloaded methods